Next: , Previous: , Up: Auxiliary Systems   [Contents][Index]


18.5 File Utilities

Some implementations of Hemlock provide extensive directory editing commands, Dired, including a single wildcard feature. An asterisk denotes a wildcard.

Function: dired:copy-file spec1 spec2 &key :update :clobber: directory

This function copies spec1 to spec2. It accepts a single wildcard in the filename portion of the specification, and it accepts directories. This copies files maintaining the source’s write date.

If spec1 and spec2 are both directories, this recursively copies the files and subdirectory structure of spec1; if spec2 is in the subdirectory structure of spec1, the recursion will not descend into it. Use "/spec1/*" to copy only the files from spec1 to directory spec2.

If spec2 is a directory, and spec1 is a file, then this copies spec1 into spec2 with the same pathname-name.

When :update is non-nil, then the copying process only copies files if the source is newer than the destination.

When :update and :clobber are nil, and the destination exists, the copying process stops and asks the user whether the destination should be overwritten.

When the user supplies :directory, it is a list of pathnames, directories excluded, and spec1 is a pattern containing one wildcard. This then copies each of the pathnames whose pathname-name matches the pattern. Spec2 is either a directory or a pathname whose pathname-name contains a wildcard.

Function: dired:rename-file spec1 spec2 &key :clobber :directory

This function renames spec1 to spec2. It accepts a single wildcard in the filename portion of the specification, and spec2 may be a directory with the destination specification resulting in the merging of spec2 with spec1. If :clobber is nil, and spec2 exists, then this asks the user to confirm the renaming. When renaming a directory, end the specification without the trailing slash.

When the user supplies :directory, it is a list of pathnames, directories excluded, and spec1 is a pattern containing one wildcard. This then copies each of the pathnames whose pathname-name matches the pattern. Spec2 is either a directory or a pathname whose pathname-name contains a wildcard.

Function: dired:delete-file spec &key :recursive :clobber

This function deletes spec. It accepts a single wildcard in the filename portion of the specification, and it asks for confirmation on each file if :clobber is nil. If :recursive is non-nil, then spec may be a directory to recursively delete the entirety of the directory and its subdirectory structure. An empty directory may be specified without :recursive being non-nil. Specify directories with the trailing slash.

Function: dired:find-file name &optional directory find-all

This function finds the file with file-namestring name, recursively looking in directory. If find-all is non-nil (defaults to nil), then this continues searching even after finding a first occurrence of file. Name may contain a single wildcard, which causes find-all to default to t instead of nil.

Function: package:make-directory name

This function creates the directory with name. If it already exists, this signals an error.

Function: dired:pathnames-from-pattern pattern files

This function returns a list of pathnames from the list files whose file-namestring’s match pattern. Pattern must be a non-empty string and contain only one asterisk. Files contains no directories.

Variable: dired:*update-default*
Variable: dired:*clobber-default*
Variable: dired:*recursive-default*

These are the default values for the keyword arguments above with corresponding names. These default to nil, t, and nil respectively.

Variable: dired:*report-function*
Variable: dired:*error-function*
Variable: dired:*yesp-function*

These are the function the above routines call to report progress, signal errors, and prompt for yes or no. These all take format strings and arguments.

Function: merge-relative-pathnames pathname default-directory

This function merges pathname with default-directory. If pathname is not absolute, this assumes it is relative to default-directory. The result is always a directory pathname.

Function: directoryp pathname

This function returns whether pathname names a directory: it has no name and no type fields.


Next: Beeping, Previous: Spelling, Up: Auxiliary Systems   [Contents][Index]