[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

11.6.3 File attibute utilities

Function: file-type path &keyword follow-link?
Function: file-perm path &keyword follow-link?
Function: file-mode path &keyword follow-link?
Function: file-ino path &keyword follow-link?
Function: file-dev path &keyword follow-link?
Function: file-rdev path &keyword follow-link?
Function: file-nlink path &keyword follow-link?
Function: file-uid path &keyword follow-link?
Function: file-gid path &keyword follow-link?
Function: file-size path &keyword follow-link?
Function: file-atime path &keyword follow-link?
Function: file-mtime path &keyword follow-link?
Function: file-ctime path &keyword follow-link?
These functions return the attribute of file/directory specified by path. The attribute name corresponds to the slot name of <sys-stat> class (See section 6.21.3.4 File stats). If the named path doesn't exist, #f is returned.

If path is a symbolic link, these functions queries the attributes of the file pointed by the link, unless an optional argument follow-link? is given and false.

MzScheme and Chicken have file-size. Chicken also has file-modification-time, which is file-mtime.

Function: file-is-readable? path
Function: file-is-writable? path
Function: file-is-executable? path
Returns #t if path exists and readable/writable/executable by the current effective user, respectively. This API is taken from STk.

Function: file-eq? path1 path2
Function: file-eqv? path1 path2
Function: file-equal? path1 path2
Compares two files specified by path1 and path2. file-eq? and file-eqv? checks if path1 and path2 refers to the identical file, that is, whether they are on the same device and have the identical inode number. The only difference is when the last component of path1 and/or path2 is a symbolic link, file-eq? doesn't resolve the link (so compares the links themselves) while file-eqv? resolves the link and compares the files referred by the link(s).

file-equal? compares path1 and path2 considering their content, that is, when two are not the identical file in the sense of file-eqv?, file-equal? compares their content and returns #t if all the bytes match.

The behavior of file-equal? is undefined when path1 and path2 are both directories. Later, it may be extended to scan the directory contents.

Generic Function: file-mtime=? f1 f2
Generic Function: file-mtime<? f1 f2
Generic Function: file-mtime<=? f1 f2
Generic Function: file-mtime>? f1 f2
Generic Function: file-mtime>=? f1 f2
Compares file modification time stamps. There are a bunch of methods defined, so each argument can be either one of the followings.

 
;; compare "foo.c" is newer than "foo.o"
(file-mtime>? "foo.c" "foo.o")

;; see if "foo.log" is updated within last 24 hours
(file-mtime>? "foo.c" (- (sys-time) 86400))

Generic Function: file-ctime=? f1 f2
Generic Function: file-atime=? f1 f2
Same as file-mtime=?, except these checks file's change time and access time, respectively. All the variants of <, <=, >, >= are also defined.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated by Ken Dickey on November, 28 2002 using texi2html