batch file/command to create a folder in multiple folders

I need to create a folder inside of  2600 folders.  The folder that needs to be created will be the same name. Probably the year- \2006.  The 2600 folders are at the same lvl so they all have different names.


I was hoping there was an easy way to copy or move a folder into multiple folders but it does not seem to work when I copy the folder to clipboard, then ctrl-a to select all the folders under clients and then paste.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Lee W, MVPTechnology and Business Process AdvisorCommented:
Use this ONE command on the command line, NOT in a batch file (as is, it won't work in a batch file).

FOR /F "Tokens=1" %a in ('DIR /ad /b') Do MD %a\2006
Lee W, MVPTechnology and Business Process AdvisorCommented:
TEST FIRST by using this:

FOR /F "Tokens=1" %a in ('DIR /ad /b') Do @ECHO MD %a\2006

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
wiafeliceAuthor Commented:
Perfect answer.  Is there any documentation on where you got that syntax from?  I would love to mess around with those paramaters.
Starting with Angular 5

Learn the essential features and functions of the popular JavaScript framework for building mobile, desktop and web applications.

Lee W, MVPTechnology and Business Process AdvisorCommented:
Type FOR /? at a command prompt.

Also, review: - spefically the Batch File section.
wiafeliceAuthor Commented:
Thanks for the fast replies btw,

but after working with this on a test folder I found out this does not work with folders that are long filesanmes.  The folders i need to add the \2006 folder to can be any number of words/numbers/spaces.  After looking at the syntax I'm not sure where to add the parameter.  I assume it is part of the tokens parameter.

Any info would be great

wiafeliceAuthor Commented:
after more research/testing it looks like it works with replacing the tokens=1 to tokens=*  again I am just testing this on a test folder with no problems.  I will get a solid backup before i try it on our live folder.

Thanks again for the help
Lee W, MVPTechnology and Business Process AdvisorCommented:
Yes, * will work - and possibly better if you have any folders with spaces in them (I try to avoid creating folders with spaces and don't always remember to point that out.
This Has also Helped me very much. Thank Everyone for all of the input.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Operating Systems

From novice to tech pro — start learning today.