如何读取Lisp中的所有.text文件?

如何读取Lisp中的所有.text文件?,lisp,common-lisp,readfile,Lisp,Common Lisp,Readfile,我想从Lisp中的文件夹中读取中的所有文本文件?当我使用shell脚本时,与c中的“foldername/*.txt”类似。帮助:读取一个文件: CL-USER 33 > (directory "/usr/share/examples/DTTk/*.txt") (#P"/usr/share/examples/DTTk/hotspot_example.txt" #P"/usr/share/examples/DTTk/pridist_example.txt" #P"/usr/share/e

我想从Lisp中的文件夹中读取中的所有文本文件?当我使用shell脚本时,与c中的“foldername/*.txt”类似。

帮助:读取一个文件:
CL-USER 33 > (directory "/usr/share/examples/DTTk/*.txt")
(#P"/usr/share/examples/DTTk/hotspot_example.txt"
 #P"/usr/share/examples/DTTk/pridist_example.txt"
 #P"/usr/share/examples/DTTk/opensnoop_example.txt" 
 #P"/usr/share/examples/DTTk/syscallbysysc_example.txt"
 #P"/usr/share/examples/DTTk/rwbytype_example.txt"  ...)

CL-USER 34 > (mapcar (lambda (path)
                        (with-output-to-string (o)
                          (with-open-file (s path)
                            (loop for line = (read-line s nil)
                                  while line do (write-line line o)))))
                     *)
("The following is a demonstration of the hotspot.d script. ... " ...)