2012-07-22 29 views

回答

6

見Common Lisp的Hyperspec的Filenames Dictionary

(first (last (pathname-directory some-pathname))) 
+0

這隻有在路徑以結束處理的情況下削減。如果你有一個路徑'a/b/c',上面的代碼將返回'b',而basename返回'c'。 – 2017-05-05 01:45:44

+0

@KevinChen:他在問使用Lisp路徑名。 Unix basename命令僅僅是一個例子。 – 2017-05-05 06:27:35