2016 Update
This commit is contained in:
parent
948b86eafa
commit
dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions
18
Task/Make-directory-path/NewLISP/make-directory-path.newlisp
Normal file
18
Task/Make-directory-path/NewLISP/make-directory-path.newlisp
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
(define (mkdir-p mypath)
|
||||
(if (= "/" (mypath 0)) ;; Abs or relative path?
|
||||
(setf /? "/")
|
||||
(setf /? "")
|
||||
)
|
||||
(setf path-components (clean empty? (parse mypath "/"))) ;; Split path and remove empty elements
|
||||
(for (x 0 (length path-components))
|
||||
(setf walking-path (string /? (join (slice path-components 0 (+ 1 x)) "/")))
|
||||
(make-dir walking-path)
|
||||
)
|
||||
)
|
||||
|
||||
;; Using user-made function...
|
||||
(mkdir-p "/tmp/rosetta/test1")
|
||||
|
||||
;; ... or calling OS command directly.
|
||||
(! "mkdir -p /tmp/rosetta/test2")
|
||||
(exit)
|
||||
Loading…
Add table
Add a link
Reference in a new issue