All Manuals > LispWorks User Guide and Reference Manual > 38 The HCL Package

NextPrevUpTopContentsIndex

fast-directory-files

fdf-handle-directory-p

fdf-handle-directory-string

fdf-handle-last-access

fdf-handle-last-modify

fdf-handle-link-p

fdf-handle-size

fdf-handle-writable-p

Functions
Summary

Maps a callback on the names of files in a specified directory and returns a list of those for which the callback returned true. The callback can retrieve information about the files.

Package

hcl

Signature

fast-directory-files dir-pathname callback => result

fdf-handle-directory-p fdf-handle => directory-p

fdf-handle-directory-string fdf-handle => directory-string

fdf-handle-last-access fdf-handle => last-access

fdf-handle-last-modify fdf-handle => last-modify

fdf-handle-link-p fdf-handle => link-p

fdf-handle-size fdf-handle => size

fdf-handle-writable-p fdf-handle => writable-p

Arguments

dir-pathname

A pathname designator without wild characters in its directory path.

callback

A function designator.

fdf-handle

An opaque object used to retrieve information about a file in dir-pathname.

Values

result

A list of strings.

directory-p, link-p, writable-p

Booleans.

directory-string

A string.

last-access, last-modify, size

Integers.

Description

The function fast-directory-files maps the function callback on the names of the files in directory specified by dir-pathname, and returns a list of the names for which callback returned non-nil.

dir-pathname must be a pathname designator, which does not contain wild characters in its directory path. To be useful, it should either be a directory (with no name and type), or with wild name and/or type.

callback must be a function of two arguments, the name of the file and an opaque object which is referred to as the fdf-handle. The fdf-handle can be used to retrieve information about the file, by calling any of the fdf-handle-* functions documented on this page.

fast-directory-files traverses the files that match dir-pathname in an undefined way, and for each file calls the callback with the file's name (not including the directory) and a fdf-handle. If callback returns non-nil it adds the name to a list. It returns the list of names for which the callback returned non-nil. Note that the names do not contain the directory name.

The fdf-handle can be accessed by the following readers. Functions named in parentheses would return the same value when called on the full path of the file:

fdf-handle-size returns the size of the file in bytes.

fdf-handle-last-modify returns the universal time of the last modification of the file (cl:file-write-date).

fdf-handle-last-access returns the universal time of the last access of the file.

fdf-handle-directory-p is a predicate for whether the file is a directory (file-directory-p)

fdf-handle-link-p is a predicate for whether the file is a soft link (always returns nil on Windows).

fdf-handle-writable-p is a predicate for whether the file is writable (file-writable-p).

fdf-handle-directory-string returns a string with the directory path followed by a separator. Therefore the full path of the file can be constructed by:

(string-append (fdf-handle-directory-string fdf-handle
)
               name
)
Notes

The fdf-handle can be used only within the dynamic scope of the callback to which it was passed.

See also

directory
Fast access to files in a directory


LispWorks User Guide and Reference Manual - 13 Feb 2015

NextPrevUpTopContentsIndex