Create multiple nested directories ubuntu windows – Code Example


In this article we will provide you the code for creating multiple nested directories on ubuntu, windows, macos and other linux or unix based operating systems. on windows, we can use WSL.

Use mkdir -p directory_structure to create your nested directories.

Code Example –

[email protected]:~/Desktop$ mkdir -p marvel/superhero/tony/ironman justice/superhero/kalel/superman marvel/superhero/bruce/hulk

This command will create multiple root directories as well as child folders on Desktop. The folder structure will look like this –

- Desktop
|- marvel
|  |_ superhero
|     |- tony
|     |  |_ ironman
|     |_ bruce
|        |_ hulk
|_ justice
   |_ superhero
      |_ kalel
         |_ superman
creating multiple nested directories using mkdir -p terminal command in ubuntu, windows wsl