Anonymous user
Make directory path: Difference between revisions
→Tcl: Added implementation
(modify Clojure example to return true if directory already exists) |
(→Tcl: Added implementation) |
||
Line 1:
{{task}}
Create a directory and any missing parents.
Line 10 ⟶ 9:
It's likely that your language implements such a function as part of its standard library. If so, please also show how such a function would be implemented.
=={{header|Clojure}}==
Line 154 ⟶ 152:
FileUtils.mkdir_p("path/to/dir") </lang>
mkdir_p also takes an array of pathnames instead of a single pathname as an argument.
=={{header|REXX}}==
The following works with any modern (Microsoft) Windows ® and/or DOS.
Line 165 ⟶ 164:
/*stick a fork in it, we're done.*/</lang>
=={{header|Tcl}}==
Tcl's built in <code>file mkdir</code> works exactly this way:
<lang tcl>file mkdir ./path/to/dir</lang>
If a directory cannot be made (e.g., because it would involve making a directory with the same name as an existing file) the command will throw a trappable error, as normal for Tcl commands.
=={{header|UNIX Shell}}==
|