Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create folders from a list 1

Status
Not open for further replies.

ITSTOAST

Technical User
Mar 3, 2005
71
GB
Hi all,
I am looking to create a range of folders in a directory. I have a list of the folder names and need a script to acces this and create a folder from this name in the directory I specify.
Thanks


Only the good die young, me I'm here forever :)
 
Hello itstoast!

Check out this thread...
thread329-1032777

Good luck!

He who has knowledge spares his words, and a man of understanding is of a calm spirit. Even a fool is counted wise when he holds his peace; when he shuts his lips, he is considered perceptive. - King Solomon
 
Hi Snotmare,
almost what I need, I have a list in notepad that I wish to import to the script, then allow it to create the folders based on this.

Only the good die young, me I'm here forever :)
 
Depending on how the folders are listed, you can simply read the text file like this...
Code:
dim objFileSys, objReadFile
Const ForReading = 1, ForWriting = 2, ForAppending = 8

Set objFileSys = CreateObject("Scripting.FileSystemObject")
Set objReadFile = objFileSys.OpenTextFile("c:\file.txt", ForReading)

Do until objReadFile.AtEndOfStream = True
    Call subCreateFolder(objReadFile.ReadLine)
Loop
objReadFile.Close
Set objReadFile = Nothing
Set objFileSys = Nothing
Just to state the obvious, in subCreateFolder(), you would then have the code from the post I mentioned that creates your folder. Also, this will only work if your text file looks something like this...
Code:
c:\folder1
c:\folder2
c:\folder3\folder3a\folder3ai
c:\folder3\folder3b

Good luck!

He who has knowledge spares his words, and a man of understanding is of a calm spirit. Even a fool is counted wise when he holds his peace; when he shuts his lips, he is considered perceptive. - King Solomon
 
Looks good I'll give it a whirl

Only the good die young, me I'm here forever :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top