Next Previous Up Top Contents Index

8 The File-System Module

8.4 Manipulating directories

The File-System module contains a number of interfaces that let you create and delete directories. These can be used in conjunction with the file manipulation operations described in Section 8.3 on page 156 to perform file management tasks at any position in the file system.

create-directory

Function

create-directory parent name => directory

Creates a new directory name in the directory parent. The full pathname of the directory is returned, and you can use this return value in conjunction with concatenate to create pathnames of any entities that you create in the new directory.
delete-directory

Function

delete-directory directory => ()

Deletes a directory specified by directory. Whether or not the directory needs to be empty before it can be deleted is determined by the platform on which you are running.
ensure-directories-exist

Function

ensure-directories-exist file => created? 

Use this function when you want to guarantee that a particular directory structure has been created on disk. It ensures that the individual directories that constitute the pathname specified by file exist, and creates any that do not. If ensure-directories-exist actually creates any directories, then #t is returned.
do-directory

Function

do-directory function directory => ()

Performs function once for every item in the specified directory. The function must have the following signature:
function directory name type => ()

where directory is the name of the directory specified to do-directory, name is an instance of <byte-string>, and type is an instance of <file-type>.
Within function, you can concatenate the values of directory and name to generate a <pathname> suitable for use by the other functions in the File-system module.
working-directory-setter

Function

working-directory-setter directory => directory

Sets the working directory for the current process.

System and I/O Reference - 31 MAR 2000

Next Previous Up Top Contents Index