Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

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
share|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. –  nomidesigns 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\ –  nomidesigns 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? –  nomidesigns 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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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