Saturday, 16 September 2017

windows - Add a new folder to each subfolder


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.



Answer



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"

No comments:

Post a Comment

Where does Skype save my contact's avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...