Arguments: function directory &key filter prune-directories include-directories (recurse t) (file-type :pathname)
This function can be used to walk a directory structure rooted at directory. function is applied to each file in the directory. directory can contain wildcards. This function is called for the side effects of applying function to files (and optionally directories) in directory. No useful value is returned.
If filter is true, then its value should be a function used to filter out candidate files and directories. The filter function takes one argument, a pathname, and returns a true value if function should be called on this file. It does not prevent recursion if the pathname is a directory.
The argument file-type controls whether a
pathname object or a namestring is passed to
function. The allowable values are
:pathname
(the default) and
:string
. If the directory of interest is very
large, specifying :string
(and ensuring that
function works as desired with a string argument)
may significantly reduce consing.
If include-directories is true, then function also gets called on directories.
If recurse is true (the default), then map-over-directory descends into subdirectories and maps over the files (or files and directories) in them. Note that this argument and include-directories are disjoint. This argument controls whether the contents subdirectories are mapped over. include-directories controls whether directories are passed to function or not.
prune-directories, if specified, must be a list of strings naming directories with no punctuation (i.e. no slashes) or a predicate function object (not a function name, i.e. a symbol or function spec) accepting one argument of the type specified by file-type. If the value is a list, any directory encountered during the operation whose name is on the list will be ignored (neither it nor its contents nor its subdirectories will be mapped over). If the value is a predicate function, a directory for which the predicte returns true will be ignored. For example, suppose subdirectories foo and bar each have a subdirectory CVS. Then either
:prune-directories '("CVS")
or
:prune-directories '(lambda (string) (if (string= "CVS" string) t))
will cause foo/CVS and bar/CVS both to be ignored (the second example assumes file-type is :string). There is no way to have foo/CVS considered and bar/CVS ignored with this argument.
The documentation is described in introduction.htm and the index is in index.htm.
Copyright (c) 1998-2000, Franz Inc. Berkeley, CA., USA. All rights reserved.
Created 2000.10.5.