开发者

Listing directories in CLISP

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)))
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜