虽然我可以建立路径名,例如
(make-pathname :directory '(:RELATIVE "dir" "subdir" "subsubdir"))
如何从这样的路径名中取回subsubdir
(假设它是一个目录)?我需要从路径名中提取最后一个dir,就像这个Unix命令那样:
$ basename /usr/local/share/
share
答案 0 :(得分:6)
参见Common Lisp Hyperspec,Filenames Dictionary
(first (last (pathname-directory some-pathname)))