How to Create Multiple Folders Using Bash
Creating multiple folders manually can be a tedious and time-consuming task. Fortunately, there is a simple Bash command that allows you to create multiple folders quickly and effortlessly.
To create a range of folders, from 1 to 30 for example, you can use the mkdir
command along with brace expansion.
Here is the one-liner Bash command you can use:
1 | mkdir {1..30} |
This command will create 30 folders, with each folder being named numerically from 1 to 30.
It’s worth mentioning that this command is not limited to creating folders with numerical names. You can modify the command to create folders with any name pattern you desire.
Please note that this command works perfectly fine on the Bash shell and can also be used on the Zsh shell. However, it may not work on Fish shell.
If you are using Fish shell and want to achieve the same result, you’ll need to use a different command or script.
Using the mkdir
command with brace expansion is a convenient way to create multiple folders in a single line, saving you time and effort.
Tags: Bash, Folder Creation, Shell scripts