A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.lispworks.com/documentation/lw80/lw/lw-hcl-74.htm below:

fast-directory-files

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

Signatures

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

A pathname designator without wild characters in its directory path.

A function designator.

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

Values

result

A list of strings.

directory-p

A boolean.

directory-string

A string.

last-access, last-modify

Integers.

link-p

A boolean.

size

An integer.

writable-p

A boolean.

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 (referred to as fdf-handle) which 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 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 callback returned non-nil. Note that the names do not contain the directory name.

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

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

See also

directory
27.14.2 Fast access to files in a directory


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4