Return a structure s containing the following information about file.
dev
- ID of device containing a directory entry for this file.
ino
- File number of the file.
mode
- File mode, as an integer. Use the functions
S_ISREG
,S_ISDIR
,S_ISCHR
,S_ISBLK
,S_ISFIFO
,S_ISLNK
, orS_ISSOCK
to extract information from this value.modestr
- File mode, as a string of ten letters or dashes as would be returned by ls -l.
nlink
- Number of links.
uid
- User ID of file's owner.
gid
- Group ID of file's group.
rdev
- ID of device for block or character special files.
size
- Size in bytes.
atime
- Time of last access in the same form as time values returned from
time
. See Timing Utilities.mtime
- Time of last modification in the same form as time values returned from
time
. See Timing Utilities.ctime
- Time of last file status change in the same form as time values returned from
time
. See Timing Utilities.blksize
- Size of blocks in the file.
blocks
- Number of blocks allocated for file.
If the call is successful err is 0 and msg is an empty string. If the file does not exist, or some other error occurs, s is an empty matrix, err is −1, and msg contains the corresponding system error message.
If file is a symbolic link,
stat
will return information about the actual file that is referenced by the link. Uselstat
if you want information about the symbolic link itself.For example,
[s, err, msg] = stat ("/vmlinuz") s = { atime = 855399756 rdev = 0 ctime = 847219094 uid = 0 size = 389218 blksize = 4096 mtime = 847219094 gid = 6 nlink = 1 blocks = 768 mode = -rw-r--r-- modestr = -rw-r--r-- ino = 9316 dev = 2049 } err = 0 msg =