Memoize

BasicWerk   EC Support   Technique   Facebook  

20140921235840_Common_Lisp_pathname

Common_Lisp_pathname

 

 
;; 存在確認
* (probe-file #P"some.file")
T
 
;; Relative path -> Absolute path
* (directory #P"some.file")
(#P"/Users/someone/path/to/some.file")
 
;; dirname
* (pathname-directory (car (directory #P"some.file")))
(:ABSOLUTE "Users" "someone" "path" "to")
 
* (directory-namestring (car (directory #P"some.lisp")))
"/Users/someone/path/to/"
 
;; basename
* (file-namestring #P"/Users/someone/path/to/some.file")
"some.file"
 
;; 拡張子
* (pathname-type #P"/Users/someone/path/to/some.file")
"file"
* (pathname-type #P"some.lisp")
"lisp"
 
;; 拡張子を除いたファイル名
* (pathname-name #P"/Users/someone/path/to/some.file")
"some"
 

 

http://www.gigamonkeys.com/book/files-and-file-io.html

 


© Shin Nakamura/BasicWerk 2014