Make directory path: Difference between revisions

(Added PicoLisp)
Line 211:
Creates directory specified by path, creating intermediate directories as necessary, and never fails if path already exists.
<lang Mathematica>mkdirp[path_] := Quiet[CreateDirectory[path,{CreateIntermediateDirectories->True}],{CreateDirectory::filex}]</lang>
 
=={{header|NewLISP}}==
<lang newlisp>(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)
)
)
 
(mkdir-p "/tmp/rosetta/test/")
(exit)</lang>
 
=={{header|Perl}}==
62

edits