Gizmos Freeware Reviews  

Go Back   Gizmo's Freeware Forum > Freeware Forum > I Want a Freeware Program that ...

Reply
 
Thread Tools Display Modes
Old 27. Oct 2011, 01:05 AM   #1 (permalink)
Member
 
Join Date: Apr 2011
Posts: 13
Question Creates a folder for each name on the list.

Looking for freeware that will take a list of 100 names and create a folder for each name on the list.
MrHappyGoLucky12 is offline   Reply With Quote
Old 27. Oct 2011, 05:32 AM   #2 (permalink)
Foundation Editor
 
Ritho's Avatar
 
Join Date: Apr 2008
Location: Planet Earth
Posts: 1,391
Default

A good old batch file should do this for you. First save your list as a plain text file called namelist.txt with one name on each line, then take the following code save it in another text file and name it something like List2folder.bat Important!-- Make sure the txt extention is renamed to .bat (You should get a warning from Windows saying something like, the file may become unusable if you change the extention, which is fine change it anyway.)

Code:
@ echo off
for /f  %%f in (namelist.txt) do md %%f
Usage: Put both the bat file and the namelist.txt file in the location where you want your folders created. Then run the bat file like as if it were a program. In a few seconds you should have your list of folders.

How this works is it reads each line from your list (i.e. /f ) adds the name in that line to the variable (%%f) then uses the md (make directory) command to make a folder with that name. Then repeats until it comes to the end of your list.

Please let me know if you have any problems.
__________________
The smallest good deed is better than the greatest intention.
Ritho is offline   Reply With Quote
Old 27. Oct 2011, 01:46 PM   #3 (permalink)
Member
 
Join Date: Apr 2011
Posts: 13
Thumbs up

Great! Thanks!
MrHappyGoLucky12 is offline   Reply With Quote
Old 27. Oct 2011, 03:03 PM   #4 (permalink)
Member
 
Join Date: Apr 2011
Posts: 13
Default

The names were, for example, John Doe and Jane Doe. The folders I got when I ran the batch file were John and Jane. How do I get the last name included?
MrHappyGoLucky12 is offline   Reply With Quote
Old 27. Oct 2011, 04:22 PM   #5 (permalink)
Foundation Editor
 
Ritho's Avatar
 
Join Date: Apr 2008
Location: Planet Earth
Posts: 1,391
Default

Duh! I should have thought of that, since you said names.

We need to set a "delimiter" to ignore spaces commas and such, then make sure the md command writes the variable as a "string" so we will add to the code. Changes are in red.

Code:
@ echo off
for /f "delims=" %%f in (namelist.txt) do md "%%f"
Note: The above should work in most cases. However some text editors, like windows notepad, will do strange things with <tab>. So avoid using a tab between names if possible. If you use a text editor that puts in a true tab then the code will work just fine.
__________________
The smallest good deed is better than the greatest intention.
Ritho is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT +1. The time now is 06:35 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 PL2