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

**URL:** <https://boards.straightdope.com/t/is-there-any-way-to-make-folders-in-windows-from-a-list-of-names/418969>\
**Category:** Factual Questions\
**Created:** [September 12, 2007, 8:32pm UTC](https://boards.straightdope.com/t/is-there-any-way-to-make-folders-in-windows-from-a-list-of-names/418969 "2007-09-12T20:32:56Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sam\_Lowry](https://avatars.discourse-cdn.com/v4/letter/s/e95f7d/32.png) [@Sam\_Lowry](https://boards.straightdope.com/u/Sam_Lowry)\
**Post date:** [September 12, 2007, 8:32pm UTC](https://boards.straightdope.com/t/is-there-any-way-to-make-folders-in-windows-from-a-list-of-names/418969/1 "2007-09-12T20:32:56Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ZipperJJ](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/zipperjj/32/211_2.png) [@ZipperJJ](https://boards.straightdope.com/u/ZipperJJ)\
**Post date:** [September 12, 2007, 8:40pm UTC](https://boards.straightdope.com/t/is-there-any-way-to-make-folders-in-windows-from-a-list-of-names/418969/2 "2007-09-12T20:40:53Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![KneadToKnow](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/kneadtoknow/32/3999_2.png) [@KneadToKnow](https://boards.straightdope.com/u/KneadToKnow)\
**Post date:** [September 12, 2007, 8:42pm UTC](https://boards.straightdope.com/t/is-there-any-way-to-make-folders-in-windows-from-a-list-of-names/418969/3 "2007-09-12T20:42:07Z")

</div>

Batch files are still alive and well, folks.

```auto

cd \parentfoldernamegoeshere
md Apples
md Bananas
md Oranges
md Grapes

```

---

<div class="post-metadata">

**Author:** ![friedo](https://avatars.discourse-cdn.com/v4/letter/f/8edcca/32.png) [@friedo](https://boards.straightdope.com/u/friedo)\
**Post date:** [September 12, 2007, 9:05pm UTC](https://boards.straightdope.com/t/is-there-any-way-to-make-folders-in-windows-from-a-list-of-names/418969/4 "2007-09-12T21:05:54Z")

</div>

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

```auto

use strict;
use warnings;

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

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

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

```

---

<div class="post-metadata">

**Author:** ![Sam\_Lowry](https://avatars.discourse-cdn.com/v4/letter/s/e95f7d/32.png) [@Sam\_Lowry](https://boards.straightdope.com/u/Sam_Lowry)\
**Post date:** [September 12, 2007, 9:14pm UTC](https://boards.straightdope.com/t/is-there-any-way-to-make-folders-in-windows-from-a-list-of-names/418969/5 "2007-09-12T21:14:01Z")

</div>

Thanks for your help.

[QUOTE=KneadToKnow]  
Batch files are still alive and well, folks.

```auto

cd \parentfoldernamegoeshere
md Apples
md Bananas
md Oranges
md Grapes

```

[/QUOTE]

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.

---

<div class="post-metadata">

**Author:** ![Dewey\_Finn](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/dewey_finn/32/4222_2.png) [@Dewey\_Finn](https://boards.straightdope.com/u/Dewey_Finn)\
**Post date:** [September 12, 2007, 9:19pm UTC](https://boards.straightdope.com/t/is-there-any-way-to-make-folders-in-windows-from-a-list-of-names/418969/6 "2007-09-12T21:19:41Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Ximenean](https://avatars.discourse-cdn.com/v4/letter/x/aca169/32.png) [@Ximenean](https://boards.straightdope.com/u/Ximenean)\
**Post date:** [September 12, 2007, 9:22pm UTC](https://boards.straightdope.com/t/is-there-any-way-to-make-folders-in-windows-from-a-list-of-names/418969/7 "2007-09-12T21:22:20Z")

</div>

[QUOTE=friedo]  
I don’t think a DOS batch script can read in a list of names from a text file, though.  
[/QUOTE]

Sure it can:

```auto

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

```

---

<div class="post-metadata">

**Author:** ![Sam\_Lowry](https://avatars.discourse-cdn.com/v4/letter/s/e95f7d/32.png) [@Sam\_Lowry](https://boards.straightdope.com/u/Sam_Lowry)\
**Post date:** [September 12, 2007, 9:23pm UTC](https://boards.straightdope.com/t/is-there-any-way-to-make-folders-in-windows-from-a-list-of-names/418969/8 "2007-09-12T21:23:26Z")

</div>

[QUOTE=Dewey Finn]  
Use quotation marks around the folder names. I just tried it and that seemed to work.  
[/QUOTE]

That did work! Thank you.
