I've been trying to see get a list of all files within a directo开发者_JS百科ry in CLISP, but I've only been able to get all non-directory files within a directory.
I'm currently trying this in Windows 7 with cygwin, so that may influence my results. I'm pretty new to CLISP (and LISP over all), and what I'm currently trying to do is as follows:
(directory (make-pathname :directory
'(:absolute "cygdrive" "c" "Download")
:name :wild))
This successfully returns all non-directory files within "C:\Download. However, it doesn't return directories. I've searched all over, and all Common Lisp references point to using "directory", but it seems impossible to me that there is no Common Lisp (or CLISP only perhaps?) way to address all files within a directory.
Any help would be appreciated. Thanks in advance!
See the CLISP implementation notes, section 20.3.2:
"If you want all the files and subdirectories in the current directory, you should use (NCONC (DIRECTORY "*/") (DIRECTORY "*"))
."
In Common Lisp in what turned out to be perhaps an unfortunate decision, directories are not files. Therefore to obtain a list of directories in you example you need a wildcard in the directory fragment:
(directory
(make-pathname :directory
'(:absolute "cygdrive" "c" "Download" :wild)))
精彩评论