Next: Directories
Up: Filesystem Utilities
Previous: Pathnames
The file management utilities are:
- (file-exists? path) returns #t
if a file (not a directory) path exists, #f
otherwise. Unlike some other procedures that take a path argument,
this procedure never raises the exn:i/o:filesystem
exception.
- (link-exists? path) returns #t
if a link path exists (Unix, BeOS, and MacOS), #f
otherwise. Note that the predicates file-exists? or
directory-exists? work on the final destination of a link or
series of links, while link-exists? only follows links to
resolve the base part of path (i.e., everything except the last
name in the path). This procedure never raises the
exn:i/o:filesystem exception.
- (delete-file path) deletes the file
with pathname path if it exists, returning void if a file
was deleted successfully, otherwise the
exn:i/o:filesystem exception is raised. If path is a link, the link is
deleted rather than the destination of the link.
-
(rename-file-or-directory old-path new-path) renames the file or
directory with pathname old-path -- if it exists -- to the
pathname new-path. If the file or directory is renamed
successfully, void is returned, otherwise the
exn:i/o:filesystem exception is raised. This procedure can be used to move a
file/directory to a different directory (on the same disk) as well as
rename a file/directory within a directory. The pathname
new-path cannot refer to an existing file or directory. If
old-path is a link, the link is renamed rather than the
destination of the link.
- (file-or-directory-modify-seconds path)
returns the file or directory's last modification date as
platform-specific seconds (see also section 11.4). If no file or
directory path exists, the exn:i/o:filesystem exception is raised.
-
(file-or-directory-permissions path) returns a list containing
'read, 'write, and/or 'execute
for the given file or directory path. If no such file or directory
exists, the exn:i/o:filesystem exception is raised.
- (file-size path) returns the (logical)
size of the specified file. (Under MacOS, this is the sum of the data
fork and resource fork sizes.) If no such file exists, , the
exn:i/o:filesystem exception is raised.
- (copy-file src-path dest-path)
creates the file dest-path as a copy of src-path. If the
file is successfully copied, void is returned, otherwise the
exn:i/o:filesystem exception is raised. If dest-path already exists, the
copy will fail. File permissions are preserved in the copy. Under
MacOS, the resource fork is also preserved in the copy.
Next: Directories
Up: Filesystem Utilities
Previous: Pathnames
PLT