Recusive folder creation in terminal

January 20th, 2018

In the terminal on linux systems it is possible to create folders recursively.

In order to do so you need to use the -p flag of the mkdir command. Additionally you can group folders on the same level by comma separating them and wrapping them in curly brackets.

Example:

mkdir -p tmpdir/{trunk/sources/{includes,docs},branches,tags}

The above command will produce the following folder structure:

tmpdir
├── branches
├── tags
└── trunk
    └── sources
        ├── docs
        └── includes

Categories

Tags