Difference between revisions of "Create a directory"

From CodeCodex

m
(Added common lisp implementation)
Line 1: Line 1:
 
==Implementations==
 
==Implementations==
 +
===Common Lisp===
 +
<pre>
 +
(ensure-directories-exist "/path/name/")
 +
</pre>
 +
See the CLHS: [http://www.lisp.org/HyperSpec/Body/fun_ensure-di_tories-exist.html#ensure-directories-exist ensure-directories-exist]
 +
 
===Java===
 
===Java===
 
<pre>
 
<pre>

Revision as of 07:43, 16 December 2006

Implementations

Common Lisp

(ensure-directories-exist "/path/name/")

See the CLHS: ensure-directories-exist

Java

    // Create a directory; all ancestor directories must exist
    boolean success = (new File("directoryName")).mkdir();
    if (!success) {
        // Directory creation failed
    }
    
    // Create a directory; all non-existent ancestor directories are
    // automatically created
    success = (new File("directoryName")).mkdirs();
    if (!success) {
        // Directory creation failed
    }

OCaml

# Unix.mkdir "foo" 666;;
- : unit = ()