Create Nested Folders in One Go with mkdir -p

Build a whole folder path — parents included — with a single mkdir command.

macOSFilesLow risk
Run mkdir -p followed by the full path to create the folder and every missing parent in one step.

01Command

Command
$ mkdir -p ~/Documents/Projects/2026/Invoices

02What it does

Without -p, mkdir fails the moment any parent folder is missing, so deep paths need one command per level. With -p the entire chain is created in order, and re-running it on an existing folder is a harmless no-op instead of an error. Separate several paths with spaces to build multiple trees at once. Brace expansion like Projects/{2025,2026}/Invoices creates both years in one command.

03Risk

RiskLow risk

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

  • mkdir – Make directories
    ss64.com · technical · 2026-09-17
    Evidence: mkdir -p creates the named directory plus any missing parent directories, and does not complain if the target already exists.

Last verified: 2026-09-18 · Category: Files & Folders

06Related solutions