Skip to content

FileSystemAPI

leftmike edited this page May 14, 2016 · 1 revision

(import (foment base)) to use these procedures.

Windows and Unix

procedure: (file-size filename)

Return the size of filename in bytes. If filename does not exist, an error that satifies file-error? is signaled.

procedure: (file-regular? filename)

Return #t if filename is a regular file and #f otherwise.

procedure: (file-directory? filename)

Return #t if filename is a directory and #f otherwise.

procedure: (file-symbolic-link? filename)

Return #t if filename is a symbolic link and #f otherwise.

procedure: (file-readable? filename)

Return #t if filename is readable and #f otherwise.

procedure: (file-writable? filename)

Return #t if filename is writable and #f otherwise.

procedure: (file-stat-mtime filename)

Return when filename was last modified in seconds since the beginning of time. If filename does not exist, an error that satifies file-error? is signaled.

procedure: (file-stat-atime filename)

Return when filename was last accessed in seconds since the beginning of time. If filename does not exist, an error that satifies file-error? is signaled.

procedure: (create-symbolic-link old_path new_path)

Create a symbolic link named newpath_ that points at old_path. If the operation fails, an error that satifies file-error? is signaled.

procedure: (rename-file old_path new_path)

Rename file from oldpath_ to new_path, overwriting new_path if it already exists. If the operation fails, an error that satifies file-error? is signaled.

procedure: (create-directory path)

Create a directory named path. If the operation fails, an error that satifies file-error? is signaled.

procedure: (delete-directory path)

Delete the directory named path. If the operation fails, an error that satifies file-error? is signaled.

procedure: (list-directory path)

Return the contents of the directory named path as a list of strings, where each string is the name of a file contained in the directory. . and .. are not included in the list. If the operation fails, an error that satifies file-error? is signaled.

procedure: (current-directory)
procedure: (current-directory` path)

Without an argument, the current working directory is returned. With an argument, the current working directory is set to path. If the operation fails, an error that satifies file-error? is signaled.

Windows Only

procedure: (file-archive? filename)

Return #t if filename has the archive attribute and #f otherwise.

procedure: (file-system? filename)

Return #t if filename has the system attribute and #f otherwise.

procedure: (file-hidden? filename)

Return #t if filename has the hidden attribute and #f otherwise.

Unix Only

procedure: (file-executable? filename)

Return #t if filename is executable and #f otherwise.

Clone this wiki locally