Peyman Eskandari

Create multiple folders at once on the terminal

Dev Tips
August 08, 2020
|
1 minutes read
Create multiple folders at once on the terminal
Photo by Viktor Talashuk

I think you are familiar with the problem. You start a new project and to make the structure you should do something like this:

mkdir new-project && cd new-project
mkdir src && cd src

// Create folders
mkdir components
mkdir assets
mkdir configs
mkdir locales
// ...
// WHAT THE HELL?

This is so frustrating! There should be a better solution 🤔

You can use this syntax to create multiple folders in a directory at once. Plain and simple:

mkdir -p new-project/src/{components,assets,configs,locales}

😲 Just that? Yes, just that. But let’s review what happened here:


Wasn’t that bad, hah?

2024. Inspired from a lot of websites and developed by copying from tutorials (just kidding 😬).