Make directory path: Difference between revisions

→‎{{header|Perl 6}}: add custom solution
(→‎{{header|Perl 6}}: add custom solution)
Line 226:
 
<lang perl6>mkdir 'path/to/dir'</lang>
 
Alternatively, a custom solution (as per task description) that only uses the built-in <tt>mkdir</tt> non-recursively. The "triangle reduce" meta-operator <code>[\ ]</code> is used get the intermediate results of a left fold with the comma operator on the list of path elements.
 
<lang perl6>for [\,] $*SPEC.splitdir("../path/to/dir") -> @path {
mkdir $_ unless .e given $*SPEC.catdir(@path).IO;
}</lang>
 
=={{header|PowerShell}}==
Anonymous user