Create Nested Folders in One Go with mkdir -p
Build a whole folder path — parents included — with a single mkdir command.
01Command
$ mkdir -p ~/Documents/Projects/2026/Invoices02What 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
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- mkdir – Make directoriesEvidence: 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
List the biggest files in your home folder that are eating disk space.
Make Finder display .pdf, .docx, .png and every other extension at all times.
List every open file descriptor — files, directories, and network sockets — per process.