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.

\clients\abc\2006
---------\bcd\2006
----------\cdf\2006
----------\def\2006

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.
wiafeliceAsked:
Who is Participating?
 
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
0
 
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
0
 
wiafeliceAuthor Commented:
Perfect answer.  Is there any documentation on where you got that syntax from?  I would love to mess around with those paramaters.
0
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

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

Also, review:
www.robvanderwoude.com - spefically the Batch File section.
0
 
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


0
 
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
0
 
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.
0
 
raamaya2Commented:
This Has also Helped me very much. Thank Everyone for all of the input.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.