There are several ways of creating multiple folders at once in macOS. In this blog post, we will go over two of them:
Using round braces
Suppose we wish to create folders with prefix day_ and the suffix for each folder from 1 to 3:
% mkdir day_{1..3}
The command above will create the folders with the following names: day_1, day_2, day_3.
Using a text file
-
Create a text file where you want to create your folders. For our example, we will call the filename of the text file
dirs.txt. -
In the text file, type the names of the folders you wish to create, each on a separate line. If your folder names have to have a space between them (e.g.
day 1) then either typeday\ 1or"day 1". -
Save the file and exit your text editor if you are using a command line based text editor.
-
Type the following at the command prompt:
cat dirs.txt | xargs mkdir. -
Your directories should be now created.