Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

fstat(3f) [bsd man page]

STAT(3F)																  STAT(3F)

NAME
stat, lstat, fstat - get file status SYNOPSIS
integer function stat (name, statb) character*(*) name integer statb(12) integer function lstat (name, statb) character*(*) name integer statb(12) integer function fstat (lunit, statb) integer statb(12) DESCRIPTION
These routines return detailed information about a file. Stat and lstat return information about file name; fstat returns information about the file associated with fortran logical unit lunit. The order and meaning of the information returned in array statb is as described for the structure stat under stat(2). The ``spare'' values are not included. The value of either function will be zero if successful; an error code otherwise. FILES
/usr/lib/libU77.a SEE ALSO
stat(2), access(3F), perror(3F), time(3F) BUGS
Pathnames can be no longer than MAXPATHLEN as defined in <sys/param.h>. 4.2 Berkeley Distribution May 15, 1985 STAT(3F)

Check Out this Related Man Page

STAT(3) 								 1								   STAT(3)

stat - Gives information about a file

SYNOPSIS
array stat (string $filename) DESCRIPTION
Gathers the statistics of the file named by $filename. If $filename is a symbolic link, statistics are from the file itself, not the sym- link. lstat(3) is identical to stat(3) except it would instead be based off the symlinks status. PARAMETERS
o $filename - Path to the file. RETURN VALUES
stat(3) and fstat(3) result format +--------+--------------------------------------+---+ |Numeric | | | | | | | | | Associative | | | | | | | | Description | | | | | | +--------+--------------------------------------+---+ | 0 | | | | | | | | | dev | | | | | | | | device number | | | | | | | 1 | | | | | | | | | ino | | | | | | | | inode number * | | | | | | | 2 | | | | | | | | | mode | | | | | | | | inode protection mode | | | | | | | 3 | | | | | | | | | nlink | | | | | | | | number of links | | | | | | | 4 | | | | | | | | | uid | | | | | | | | userid of owner * | | | | | | | 5 | | | | | | | | | gid | | | | | | | | groupid of owner * | | | | | | | 6 | | | | | | | | | rdev | | | | | | | | device type, if inode device | | | | | | | 7 | | | | | | | | | size | | | | | | | | size in bytes | | | | | | | 8 | | | | | | | | | atime | | | | | | | | time of last access (Unix timestamp) | | | | | | | 9 | | | | | | | | | mtime | | | | | | | | time of last modification (Unix | | | | timestamp) | | | | | | | 10 | | | | | | | | | ctime | | | | | | | | time of last inode change (Unix | | | | timestamp) | | | | | | | 11 | | | | | | | | | blksize | | | | | | | | blocksize of filesystem IO ** | | | | | | | 12 | | | | | | | | | blocks | | | | | | | | number of 512-byte blocks allocated | | | | ** | | | | | | +--------+--------------------------------------+---+ * On Windows this will always be 0. ** Only valid on systems supporting the st_blksize type - other systems (e.g. Windows) return -1. In case of error, stat(3) returns FALSE. Note Because PHP's integer type is signed and many platforms use 32bit integers, some filesystem functions may return unexpected results for files which are larger than 2GB. ERRORS
/EXCEPTIONS Upon failure, an E_WARNING is emitted. EXAMPLES
Example #1 stat(3) example <?php /* Get file stat */ $stat = stat('C:phpphp.exe'); /* * Print file access time, this is the same * as calling fileatime() */ echo 'Access time: ' . $stat['atime']; /* * Print file modification time, this is the * same as calling filemtime() */ echo 'Modification time: ' . $stat['mtime']; /* Print the device number */ echo 'Device number: ' . $stat['dev']; ?> Example #2 Using stat(3) information together with touch(3) <?php /* Get file stat */ $stat = stat('C:phpphp.exe'); /* Did we failed to get stat information? */ if (!$stat) { echo 'stat() call failed...'; } else { /* * We want the access time to be 1 week * after the current access time. */ $atime = $stat['atime'] + 604800; /* Touch the file */ if (!touch('some_file.txt', time(), $atime)) { echo 'Failed to touch file...'; } else { echo 'touch() returned success...'; } } ?> NOTES
Note Note that time resolution may differ from one file system to another. Note The results of this function are cached. See clearstatcache(3) for more details. Tip As of PHP 5.0.0, this function can also be used with some URL wrappers. Refer to "Supported Protocols and Wrappers" to determine which wrappers support stat(3) family of functionality. SEE ALSO
lstat(3), fstat(3), filemtime(3), filegroup(3). PHP Documentation Group STAT(3)
Man Page