> For the complete documentation index, see [llms.txt](https://trizen.gitbook.io/perl6-rosettacode/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://trizen.gitbook.io/perl6-rosettacode/programming_tasks/m/make_directory_path.md).

# Make directory path

There is a built-in function for this:

```perl
mkdir 'path/to/dir'
```

Alternatively, a custom solution (as per task description) that only uses the built-in `mkdir` non-recursively. The "triangle reduce" meta-operator `[\ ]` is used get the intermediate results of a left fold with the comma operator on the list of path elements.

```perl
for [\,] $*SPEC.splitdir("../path/to/dir") -> @path {
    mkdir $_ unless .e given $*SPEC.catdir(@path).IO;
}
```
