Next Previous Up Top Contents Index

4 The COMMON-LISP Package

directory

Function

Summary

Determines which files on the system have named matching a given pathname.
Package

common-lisp

Signature

directory pathname &key test directories check-for-subs link-transparency non-existent-link-destinations => pathnames

Arguments

pathname

A pathname, string, or file-stream.

test

Filtering test (only pathnames matching the test are collected).

directories

If non-nil then directories are included in the collection.

check-for-subs

If non-nil (the default), then pathnames representing directories have null name components.

link-transparency

Ifnil, then symbolic links are not followed. This means that returned names are not necessarily truenames, but has the useful feature that thepathname-directory of each pathname returned is the directory supplied as argument.

Default value is given by the special variable,system::*directory-link-transparency*, which defaults to non-nil. By setting this variable tonil, you can get the old behavior ofdirectory.

non-existent-link-destinations

If this is non-nil, then the pathname pointed to by a symbolic link appears in the output whether or not this file actually exists. If:link-transparency is non-nil and:non-existent-link-destinations isnil (i.e. the default case), then symbolic links to nonexistent files do not appear.

The default value isnil.

Values

pathnames

A list of physical pathnames.

Description

directory collects all the pathnames matching the given pathname.
directory returns truenames, conforming to the ANSI specification for Common Lisp. Some programs may depend on the old behavior, however (anddirectory is slower if it has to find the truename for every file in the directory), and so two keyword arguments are available so that the old behavior can be still be used: link-transparency and non-existent-link-destinations.
Because truenames are now returned, the entries. and.. no longer show up in the output ofdirectory. This means, for instance, that
(directory #P"/usr/users/") 

does not include#P"/usr", which is the truename of#P"/usr/users/.."
The specification is unclear as to the appropriate behavior ofdirectory in the presence of links to non-existent files or directories. For example, if the directory containsfoo, which is a symbolic link tobar, and there is no file namedbar, shouldbar show up in the directory listing? A keyword argument has been added which lets you control this behavior.
Example

NEW 37 > (directory ".")
(#P"C:/Program Files/Harlequin/LispWorks/DeIsL1.isu" 
 #P"C:/Program Files/Harlequin/LispWorks/ReadMe.txt" 
 #P"C:/Program Files/Harlequin/LispWorks/current-lib/" 
 #P"C:/Program Files/Harlequin/LispWorks/msvcrt.dll" 
 #P"C:/Program Files/Harlequin/LispWorks/shaken.exe")


LispWorks Reference Manual - 15 Oct 1998

Next Previous Up Top Contents Index

Generated with Harlequin WebMaker