Open vindarel opened 5 years ago
Also, cl-fad:walk-directory
can be used if you want to collect not only subdirectories, but also the files:
(cl-fad:walk-directory "./"
(lambda (name)
(format t "~A~%" name))
By the way, in your example, you can use (constantly t)
instead of (lambda (it) t)
.
perfect, thanks.
See
uiop:collect-sub*directories
in uiop/filesystem. It takes as arguments:directory
recursep
functioncollectp
functioncollector
functionGiven a directory, when
collectp
returns true with the directory, call thecollector
function on the directory, and recurse each of its subdirectories on whichrecursep
returns true.This function will thus let you traverse a filesystem hierarchy, superseding the functionality of
cl-fad:walk-directory
.The behavior in presence of symlinks is not portable. Use IOlib to handle such situations.
Example: