Discussion Locked

Making Directories

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I need to create about 1500 folders on one of our network drives. The folder names are on an excel spreadsheet (or any db i'd like).

Any easy way to create them? (e.g. batch file? sql statement?, etc...)

5 replies

by dklippert

You could create them using VBA in Excel. Write a short macro that includes a for..next loop. Update a variable to be used by the MKDIR Statement. Point to the Network drive
Pseudo code

for c = 1 to 1500
Read name
NewDir=name
MKDIR "K:\" & NewDir
Next c

by joseph moore

Gee, this is easy. Here is one way (BTW, I am an old BAT file guy).
If all of the directory names are in a single column by themselves:

one
two
three
etc...

Then add a column to the left of this one. In each cell in the column, put in MKDIR
So, you would then have:

MKDIR one
MKDIR two
MKDIR three
etc.

Then, click File-SaveAs and save it as a Delimited TXT file, and in the File Name box, type in:
"filename.bat"

The quotation marks are important. They force Excel to save it with the filename of filename.bat (without the quote marks). It is also a plain text file, with no Excel formatting. Just two columns of text, the old DOS make directory command and the name of the directory to make.

Ok, now, copy this file to whatever machine you need to make these 1500 directories, and run it. You can double-click the BAT file, or open a command prompt and type in the file name. Then watch it run!

Hope this helps.

This discussion is closed to new replies.