Is there any way to make folders in Windows from a list of names?

Let’s say that you are working in Windows and have a list in Excel or Microsoft Word like so:

[ul]
[li]Apples[/li][li]Bananas[/li][li]Oranges[/li][li]Grapes[/li][/ul]
Then you wanted to make folders with those names: a folder titled Apples, a folder titled Bananas, etc. Is there any way in Windows to use the list and automatically make folders with the titles from your list? It would be really helpful if there was a way to do this, instead of having to do “create new folder” and title it what I want again and again. Obviously with just four items it wouldn’t be worth it, but sometimes for work I have to do this for hundreds of folders, and it would be so much quicker if I could find a shortcut.

Thanks in advance.

Do you already have the list in digital format (like a text file)?

You could make a VBS script to do this using the FileSystem Object. Google “fso ‘create folder’” for instructions.

Just open up notepad, paste your list in there, wrap some VBScript around it, save it as .vbs and then double-click to run it.

Batch files are still alive and well, folks.


cd \parentfoldernamegoeshere
md Apples
md Bananas
md Oranges
md Grapes

I don’t think a DOS batch script can read in a list of names from a text file, though.

It’s very easy to do with Perl or another language suited to general sysadmin tasks. In Perl, you could do something like



use strict;
use warnings;

open my $fh, "list_of_names.txt" or die $!;

chdir "/path/to/parent_folder" or die $!;

while(<$fh>) { 
    chomp;
    mkdir $_;
}


Thanks for your help.

This did work for me, but not for folders that I wanted to have more than one word. For example, I tried the following batch file:

@echo off
echo cd \My Documents
md Red Apples
md Yellow Bananas
md Blood Oranges
md White Grapes
dir c:\windows

And it created the following folders:

[ul]
[/ul] [ul]
[li]Red[/li][li]Apples[/li][li]Yellow[/li][li]Bananas[/li][li]Blood[/li][li]Oranges[/li][li]White [/li][li]Grapes[/li][/ul]

How do I make it so that it doesn’t split words up?

Thanks again for your help.

Use quotation marks around the folder names. I just tried it and that seemed to work.

Sure it can:


for /f "delims=," %i in (dirnames.txt) do md "%i"

That did work! Thank you.