Usage:
r = OSSTAT("filename")
Description:
This subroutine is used to obtain information on files and folders directly available to the OS. It is mainly useful under Linux when you want to obtain information about special files (device, symlink, etc.). The return value of 1 or 0 indicates success or failure respectively. The return value contains several members that provide information about the file.
The member names are:
ST_DEV
|
The ID of the device containing the file
|
ST_INO
|
The inode number of the file
|
ST_MODE
|
The files attributes and permissions
|
ST_NLINK
|
The number of hard links to this file
|
ST_UID
|
The owners user ID
|
ST_GID
|
The owners group ID
|
ST_RDEV
|
The device ID (special files)
|
ST_SIZE
|
The total file size in bytes
|
ST_ATIME
|
Last access time (number of seconds since Jan 1, 1970)
|
ST_MTIME
|
Last modified time (number of seconds since Jan 1, 1970)
|
ST_CTIME
|
Last status change time (number of seconds since Jan 1, 1970)
|
Example:
sub main()
stat=osstat("testfile.txt")
if stat then
printl("ST_DEV:", stat.st_dev)
printl("ST_INO:", stat.st_ino)
printl("ST_MODE:", hex(stat.st_mode))
printl("ST_NLINK:", stat.st_nlink)
printl("ST_UID:", hex(stat.st_uid))
printl("ST_GID:", hex(stat.st_gid))
printl("ST_RDEV:", stat.st_rdev)
printl("ST_SIZE:", stat.st_size)
printl("ST_ATIME:", stat.st_atime)
printl("ST_MTIME:", stat.st_mtime)
printl("ST_CTIME:", stat.st_ctime)
else
printl("OSSTAT Failed")
end if
end sub
|
|