How to bulk create folders in one try on Windows 11
Do you need to create multiple folders on Windows 11? Here's a quick way to do this.
On Windows 11 (and 10), you can create a new folder through File Explorer in multiple ways, but the only caveat is that you can only create one item at a time. However, if you're working on a project or organizing files, it's possible to create multiple folders in bulk.
You can complete this task without resourcing to third-party tools using PowerShell and Command Prompt. It's also possible to create folders in different ways. For example, you can create folders with specific names, using a base name structure, and you can generate different folders extracting the names from a text file.
In this how-to guide, I'll walk you through different ways to create multiple folders at once on Windows 11. (You can also use these instructions on Windows 10.)
How to create folders with PowerShell on Windows 11
You can leverage PowerShell in many ways to create multiple folder at once, and here are three ways to complete this task.
Using specific names
To create folders with specific names through PowerShell, use these steps:
- Open Start.
- Search for PowerShell, right-click the top result, and choose the Run as administrator option.
- Type the following command to open a specific location and press Enter: cd c:/path/to/folder
In the command, specify the path to the location where you want to create the folders.
- Type the following command to create multiple folders on a specific location and press Enter: "folder-1", "folder-2", "folder-3" | %{New-Item -Name "$_" -ItemType "Directory"}
In the command, change "folder-X" for names of the folders you want to create.
Get the Windows Central Newsletter
All the latest news, reviews, and guides for Windows and Xbox diehards.
Here's a breakdown of the command:
- "folder-1", "folder-2", "folder-3": This part of the command specifies an array of strings, each representing a folder name you intend to create.
- "|": The pipeline operator takes the output from the command on its left and passes it as input to the command on its right.
- %{ }: This is a shorthand alias for the "ForEach-Object" cmdlet, which performs an operation for each item in a collection.
- New-Item: This cmdlet creates a new item with the specified properties.
- -Name "$_": Dynamically specifies the name of the new item, where "$_" is a variable that represents the current object in the pipeline.
- -ItemType "Directory": This part specifies that the item to be created is a directory (commonly known as a "folder").
Using structure name
To create multiple folders with the same name structure, use these steps:
- Open Start.
- Search for PowerShell, right-click the top result, and choose the Run as administrator option.
- Type the following command to open a specific location and press Enter: cd c:/path/to/folder
In the command, specify the path to the location where you want to create the folders.
- Type the following command to create multiple folders with the same name structure and press Enter: for ($wc=1;$wc -le 3;$wc++){MD ".\folder-$wc"}
In the command, change "3" for the number of folders to create and "folder-" for the base of the folder.
Here's a breakdown of the command:
- for: Runs the "for" loop to control the flow statement to execute a repetitive condition.
- $wc=1: Initializes the variable "$wc" to 1.
- $wc -le 3: The condition for continuing the loop. "-le" stands for "less than or equal to," meaning that as long as "$wc" is less than or equal to "3," the loop will continue to execute.
- $wc++: This increases the value of "$wc" variable by "1" with each iteration of the loop.
- { MD ".\folder-$wc" }: Includes the command to create a folder on each loop iteration.
Using text file
Before proceeding with these steps, create a file called "name-list.txt" with Notepad and make sure to create a list of the folders' names (one entry per line).
To create folders based on a list inside of a text file, use these steps:
- Open Start.
- Search for PowerShell, right-click the top result, and choose the Run as administrator option.
- Type the following command to open a specific location and press Enter: cd c:/path/to/folder
In the command, specify the path to the location where you want to create the folders.
- Type the following command to grab the text file with the list of names and create folders automatically and press Enter: get-content C:\path\to\folders.txt | %{ if($_ -match $pattern) { mkdir "C:\path\to\folder\$_"; }}
In the command, update the paths to match the locations of the text file and the folder to create the subfolders.
Here's a breakdown of the command:
- Get-Content C:\path\to\name-list.txt: This part of the command locates and reads the txt file.
- "|": The pipeline operator takes the output from the command on its left and passes it as input to the command on its right.
- %{ }: This is a shorthand alias for the "ForEach-Object" cmdlet, which performs an operation for each item in a collection.
- if($_ -match $pattern) { }: This "if" statement checks if the current line "$_" matches a pattern defined by the variable "$pattern."
- mkdir "C:\path\to\folder\$_": This part of the command creates folders in the specified path.
Once you complete the steps, the command will run, and the folders will be created according to your configuration.
How to create folders with Command Prompt on Windows 11
On Command Prompt, similar to PowerShell, you have many different ways to create multiple folders at once, and here are three useful ways to complete this task.
Using specific names
To create multiple folders through Command Prompt with specific names, use these steps:
- Open Start.
- Search for Command Prompt, right-click the top result, and choose the Run as administrator option.
- Type the following command to open a specific location and press Enter: cd c:/path/to/folder
In the command, specify the path to the location where you want to create the folders.
- Type the following command to create multiple folders with specific names and press Enter: md folder-1 folder-2 folder-3
Here's a breakdown of the command:
- md: This is short for "make directory." It's the command used to create a new directory on Windows.
- folder-1 folder-2 folder-3: These are the names of the directories you want to create.
Using structure name
To create multiple folders at once with the same based name and appending an identifier, use these steps:
- Open Start.
- Search for Command Prompt, right-click the top result, and choose the Run as administrator option.
- Type the following command to open a specific location and press Enter: cd c:/path/to/folder
In the command, specify the path to the location where you want to create the folders.
- Type the following command to create multiple folders with the same name structure and press Enter: for /L %w in (1,1,10) do mkdir folder-%w
In the command, change "10" for the number of folders you want to create. Also, in Command Prompt, for the variable, use a single letter as shown in the command example above.
Here's a breakdown of the command:
- for: Runs the "for" loop to control the flow statement to execute a repetitive condition.
- /L: This option specifies that the loop will repeat over multiple times.
- %wc: This is a variable that will hold each value.
- in (1,1,10): This part of the command specifies the number of folders to create. It starts at "1," increments by "1," and ends at "10."
- do mkdir folder-%wc: This part of the command creates folders in the specified path.
Using text file
Before proceeding with these steps, create a file called "name-list.txt" with Notepad and make sure to create a list of the folders' names (one entry per line).
To leverage Command Prompt to create multiple folders from a list on a text file, use these steps:
- Open Start.
- Search for Command Prompt, right-click the top result, and choose the Run as administrator option.
- Type the following command to open a specific location and press Enter: cd c:/path/to/folder
In the command, specify the path to the location where you want to create the folders.
- Type the following command to create multiple folders from a list in a text file and press Enter: for /f "tokens=*" %w in (folders.txt) do mkdir "%w"
In the command, change "folders.txt" for the name of the text file with names you want to use.
Here's a breakdown of the command:
- for: Runs the "for" loop to control the flow statement to execute a repetitive condition.
- /f: This option means that the loop will process the output of a command or the contents of a file.
- "tokens=*": This part of the command specifies that the entire line should be treated as a single token.
- %wc: This is the variable that will hold each line of the file name-list.txt.
- in (name-list.txt): This specifies the file from which to read the lines.
- do mkdir "%wc": This part of the command creates a folder with the name specified by each line in the file.
After you complete the steps, the command will create the folders according to your configuration.
It's important to note that these commands are meant to be run inside the console. If you're trying to create a batch file, the variables should be written as "%%wc," not "%wc."
More resources
For more helpful articles, coverage, and answers to common questions about Windows 10 and Windows 11, visit the following resources:
Mauro Huculak has been a Windows How-To Expert contributor for WindowsCentral.com for nearly a decade and has over 15 years of experience writing comprehensive guides. He also has an IT background and has achieved different professional certifications from Microsoft, Cisco, VMware, and CompTIA. He has been recognized as a Microsoft MVP for many years.