David G. Lenz, Etc. | Another geek, another blog

Jun/11

28

Create subfolders in every folder in a directory

I needed to make 2 subfolders in every directory in a particular folder. It was going to be a lot of copy/pasting of empty folders and then it dawned on me… I could use the Windows command line!

All you need to do is open up a command prompt and go to the folder that contains all the directories that you want to have subfolders made in. Then copy paste this command:

for /f "tokens=*" %G in ('dir /ad /b') do cd %G & md "New Folder 1" "New Folder 2" & cd ..

and sit back and watch the magic. If the subfolders already exist, no problem, it will get skipped. Change the “New Folder 1″ to whatever you need, and if you need a bunch of folders, its just a space delimited list.

 

No tags

No comments yet.

Leave a Reply

>>

Theme Design by devolux.nh2.me