mkdir
mkdir(path)
Input: path · Output: no output
What it is
Creates the directory path (a Str), including any missing parents — mkdir -p, not bare mkdir. Idempotent: a directory that already exists is success, not an error, because "make sure this exists" is what callers actually want.
Overloads
One call shape — this function is not overloaded.
| Code | Input | Output | Description |
mkdir(path) | path Strnot documented yet | no output | Idempotent: a directory that already exists is success, not an error, because "make sure this exists" is what callers actually want. |
Examples
From the documentation, and run by the build -- the output and the figure below are what the engine actually produced. Simplest first.
mkdir("list_demo")
write_text("list_demo/report.qu", "print(1)")
write_text("list_demo/plot.qu", "print(2)")
write_text("list_demo/notes.txt", "the needle is here")
make_file("list_demo/empty.log")
qu_files = list_files("list_demo", "*.qu")
print("{length(qu_files)} Qu files")
carrying = list_files("list_demo/*", contains = "needle")
for f in carrying
print("carries the needle: {f}")
end for
blank = list_files("list_demo/*", size = "0")
print("{length(blank)} empty file")
output
2 Qu files carries the needle: list_demo\notes.txt 1 empty file
from file-io