Add Blank Folder to Many Locations

Soldato
Joined
10 May 2004
Posts
3,751
Location
East Yorkshire, UK
Hi

I need to add a blank folder named data to about 2000 locations, I could do this manually but will take far too long. Is there another way I could do this, all the folder locations are contained within the same master folder? I'm thinking a batch file or robocopy, but have no idea about how to go about this.

Cheers
 
Permabanned
Joined
30 Jun 2009
Posts
433
Location
NI
I will bite

Best to use a batch file probably

What format do the names have to be in ?

eg it would be easy to use a counter to auto generate names like
data1
data2
etc
etc
 
Soldato
OP
Joined
10 May 2004
Posts
3,751
Location
East Yorkshire, UK
For example, I have a folder called example, in this I have folders 1, 2, 3

so..

C:/example/1
C:/example/2
C:/example/3
...and so on

In each folder, I would like a blank folder called data, so I would end up with
C:/example/1/data
C:/example/2/data
C:/example/3/data
...and so on
 
Soldato
Joined
13 Jan 2004
Posts
20,962
Assuming there is existing data? Are the structures depths all the same or random also? Are the 1,2,3 folders you want the data folder in the deepest folders in the structure?
 
Last edited:
Soldato
Joined
9 Nov 2003
Posts
9,510
Location
The Motor City
From a cmd line go to your "example" folder. dir > c:\folders.txt

Open that file in Notepad and trim off the unncessary bits from the top and bottom.

Import those results into Excel using whatever format to separate the unneeded stuff into different columns. Delete those columns so you just have the [random] name. Now insert a column in the front and put in md. Drag that down through the entire column.

In column C put in \data. Drag that down through the entire column.

Save that back as your text file and open again in Notepad. You will probably have a space or tab between the folder name a \data, so to get rid of that do a Find | Replace all and type in [space]\data, replace with no space. Might take some playing with.

Your file should now look like md [random]\data for each line.

Save the file, rename with a .bat extension, put it in your "example" folder, and run it.

** NOTE: test this on a non-production folder structure first, with just a few folders that you can modify.
 
Last edited:
Back
Top Bottom