• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 129
  • Last Modified:

Need to have an automatic way of creating new folders in Windows

I have a list of names in a text file that I need to create folders for. The list is over 1000 names long so that is over 1000 folders in Windows that needs to be created.  By hand that will take hours to do.  If I could create a batch file or a script that would read the list and create the folders based on the list.  The folders need to all be in the same root, so that makes it a bit easier.  The list is a plain text file with each name on a seperate line.  Here is an example...

name1
name2
name3
name4
name5

Also, if someone knows of a program that does this automatically, that will be okay.
0
murryc
Asked:
murryc
  • 2
  • 2
2 Solutions
 
Lee W, MVPTechnology and Business Process AdvisorCommented:
No script needed, just run this command:

FOR /F "tokens=*" %a in (listofnames.txt) do MD %a
0
 
star_trekCommented:
Also VB script:

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("C:\temp\filename.txt", 1)
Do Until objFile.AtEndOfStream
    strCharacters = objFile.ReadLine
    objFSO.createfolder strCharacters
Loop
0
 
murrycAuthor Commented:
leew...Should I not be able to run your command from a batch file?  I tried it and could not get it to work.

star_trek...your VBS script worked like a champ.  I have a few changes I need to make to the script.  Do you want me to post a new question since this one was answered fully?
0
 
star_trekCommented:
If the solution works for you, you need accept the answer. Then you can post a new question.
0
 
Lee W, MVPTechnology and Business Process AdvisorCommented:
No you can't run that command from a batch file.  I said no script needed - it's a simple command.

If you want to run the command from a batch file, then you need to double the percent signs.

FOR /F "tokens=*" %%a in (listofnames.txt) do MD %%a
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now