I have main a folder say E:\donuts and there are hundreds of folders inside it. e.g.

E:\donuts\yellow\
E:\donuts\green\
...
E:\donuts\blue\

I want to create a new folder in each subfolder simply using some DOS command. Something like this.

E:\donuts\yellow\big
E:\donuts\green\big

and so on. How can I achieve this?

Also, would to be possible move the content of each subfolder into the corresponding big folder? For instance all the files and folders in E:\donuts\yellow\ should move to E:\donuts\yellow\big and so on.

link|improve this question
feedback

1 Answer

up vote 1 down vote accepted

I haven't tested this, so you'll want to try it out first

FOR /d %A IN (e:\donuts\*) DO mkdir %A\big

This should work to do the move as well:

FOR /d %A IN (e:\donuts\*) DO mkdir %A\big & mv %A\*.* %A
link|improve this answer
Wow @paul, the first one worked like a charm. I hope the second one will work too. Thanks a lot. I have been try various combos the whole evening but now I see my syntax was wrong. – nomi49 Nov 20 '11 at 4:22
Slight modification on the second command worked for me. It moved all the files sans folders. How can I change it to move the folders too? FOR /d %A IN (e:\donuts*) DO mkdir %A\big & move %A*.* %A\big\ – nomi49 Nov 20 '11 at 4:48
Oops yeah, well done. – Paul Nov 20 '11 at 13:10
Yeah @Paul thanks to you I'm almost there but the above command only moves files not folders. How can i achieve that? – nomi49 Nov 20 '11 at 19:30
You can't easily unfortunately, the move command doesn't accept wildcard directory names – Paul Nov 20 '11 at 21:21
show 1 more comment
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.