Jump to content

Recommended Posts

Posted

Hi All,

 

I need help creating a Script file to create folders inside of other folders.

 

The specific issue I am having is I need to create Documents and a Photos folder inside of others. I have a list of over 100 usernames, (all with different names but on the same directory). All these folders are empty and I wish to create the two folders inside of the username.

 

Having a script like this would save me a great deal of time.

 

Can anyone shed some light on this?

 

Thanks

Posted

Just go to the command prompt

CD to the root of the directory and type:

 

for /d %i in (*) do mkdir %i\Photos && mkdir %i\Documents

 

Simples.

Posted

for /d

A loop that goes through directories

 

%i

This holds the name of the current directory it has found

 

 in (*)

 

Use a wildcard for working with multiple directories

 

mkdir %i\Photos && mkdir %i\Documents

 

and finish with 2 make directory command joined together with an and (&&). Every pass the %i is converted to the current folder.

 

for /d - Loop through directory | SS64.com

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...