File

Filesystem library

Summary
FileFilesystem library
(mosh file)Filesystem Library
Functions
create-directoryCreate a directory.
delete-directoryDelete a directory.
rename-fileRename a file.
create-symbolic-linkCreate a symbolic link.
file-directory?Returns #t if file is directory, otherwise #f.
file-symbolic-link?Returns #t if file is symbolic link, otherwise #f.
file-symbolic-link?Returns #t if file is symbolic link, otherwise #f.
file-regular?Returns #t if file is regular file, otherwise #f.
file-readable?Returns #t if file is readable, otherwise #f.
file-writable?Returns #t if file is writable, otherwise #f.
file-executable?Returns #t if file is executable, otherwise #f.
file-size-in-bytesReturns file size in bytes.
file-stat-mtimeReturns last modify time of file.
file-stat-atimeReturns last access time of file.
file-stat-ctimeReturns last change time (or creation time on Windows) of file.
directory-listRead directory and returns result as list of string.
file->listConvenience procedures to read from a file filename.
file->stringConvenience procedures to read from a file filename.
write-to-fileWrite string to file

(mosh file)

Filesystem Library

Summary
Functions
create-directoryCreate a directory.
delete-directoryDelete a directory.
rename-fileRename a file.
create-symbolic-linkCreate a symbolic link.
file-directory?Returns #t if file is directory, otherwise #f.
file-symbolic-link?Returns #t if file is symbolic link, otherwise #f.
file-symbolic-link?Returns #t if file is symbolic link, otherwise #f.
file-regular?Returns #t if file is regular file, otherwise #f.
file-readable?Returns #t if file is readable, otherwise #f.
file-writable?Returns #t if file is writable, otherwise #f.
file-executable?Returns #t if file is executable, otherwise #f.
file-size-in-bytesReturns file size in bytes.
file-stat-mtimeReturns last modify time of file.
file-stat-atimeReturns last access time of file.
file-stat-ctimeReturns last change time (or creation time on Windows) of file.
directory-listRead directory and returns result as list of string.
file->listConvenience procedures to read from a file filename.
file->stringConvenience procedures to read from a file filename.
write-to-fileWrite string to file

Functions

create-directory

Create a directory.

Prototype

(create-directory path)

Parameters

pathdirectory path to create.

delete-directory

Delete a directory.

Prototype

(delete-directory path)

Parameters

pathdirectory path to delete.

rename-file

Rename a file.

Prototype

(rename-file old-name new-name)

Parameters

old-nameold name.
new-namenew name to rename.

create-symbolic-link

Create a symbolic link.

Prototype

(create-symbolic-link old-name new-name)

Parameters

old-nameold name.
new-namenew name to create.

file-directory?

Returns #t if file is directory, otherwise #f.

Prototype

(file-directory? file)

Parameters

filefile.

Returns

#t #t if file is directory, otherwise #f.

file-symbolic-link?

Returns #t if file is symbolic link, otherwise #f.

Prototype

(file-directory? file)

Parameters

filefile.

Returns

#t #t if path is symbolic link, otherwise #f.

file-symbolic-link?

Returns #t if file is symbolic link, otherwise #f.

Prototype

(file-directory? file)

Parameters

filefile.

Returns

#t #t if file is symbolic link, otherwise #f.

file-regular?

Returns #t if file is regular file, otherwise #f.

Prototype

(file-regular? file)

Parameters

filefile.

Returns

#t #t if file is regular file, otherwise #f.

file-readable?

Returns #t if file is readable, otherwise #f.

Prototype

(file-readable? file)

Parameters

filefile.

Returns

#t #t if file is readable, otherwise #f.

file-writable?

Returns #t if file is writable, otherwise #f.

Prototype

(file-writable? file)

Parameters

filefile.

Returns

#t #t if file is writable, otherwise #f.

file-executable?

Returns #t if file is executable, otherwise #f.  On Windows this procedure checks the file extention.  .COM .EXE .BAT .VBS .VBE .JS .JSE .WSF .WSH .MSC are executable.

Prototype

(file-executable? file)

Parameters

filefile.

Returns

#t #t if file is executable, otherwise #f.

file-size-in-bytes

Returns file size in bytes.

Prototype

(file-size-in-bytes file)

Parameters

filefile.

Returns

file size in bytes.

file-stat-mtime

Returns last modify time of file.

Prototype

(file-stat-mtime file)

Parameters

filefile.

Returns

last modify time of file.

file-stat-atime

Returns last access time of file.

Prototype

(file-stat-atime file)

Parameters

filefile.

Returns

last access time of file.

file-stat-ctime

Returns last change time (or creation time on Windows) of file.

Prototype

(file-stat-ctime file)

Parameters

filefile.

Returns

last change time (or creation time on Windows) of file.

directory-list

Read directory and returns result as list of string.

Prototype

(directory-list path)

Parameters

pathPath to directory.

Returns

directory entries list of string.

See Also

<current-directory> and <set-current-directory!>

file->list

Convenience procedures to read from a file filename.  (read file) and returns list of S-expressions.

Prototype

(file->list file)

Parameters

filefile.

Returns

list of S-expressions.

file->string

Convenience procedures to read from a file filename.  Read whole file and returns contents as string.

Prototype

(file->string file)

Parameters

filefile.

Returns

contents as string.

write-to-file

Write string to file

Prototype

(write-to-file file contents)

Parameters

filefile.
contentsstring contents.
Close