Need some help with a batch file to creating sub-folders in a directory


I have some reports that I save on a network share.  There is a report for every calendar date and I want each report in its own sub folder.  We'll be manually saving the reports to the share after download.  

Is there a way to create a batch file that would automatically create these sub-folders using the naming convention of "MMDDYY".  I am looking to avoid having my users manually create a new folder every day.

Who is Participating?
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.

Semper PhiSystems IntegratorCommented:
Try this snippet, use what you need:
@echo off
for /f "delims=" %%a in ('wmic OS Get localdatetime  ^| find "."') do set dt=%%a
set datestamp=%dt:~0,8%
set timestamp=%dt:~8,6%
set YYYY=%dt:~0,4%
set MM=%dt:~4,2%
set DD=%dt:~6,2%
set HH=%dt:~8,2%
set Min=%dt:~10,2%
set Sec=%dt:~12,2%

set stamp=%YYYY%-%MM%-%DD%_%HH%-%Min%-%Sec%
echo stamp: "%stamp%"
echo datestamp: "%datestamp%"
echo timestamp: "%timestamp%"


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
Lionel MMSmall Business IT ConsultantCommented:
Do you want a daily batch file to run and create the folders for you so that each day the folders and sub folders are created on a server share or do you it created on each user's PC when they logon that day?
mike-9Author Commented:
I was looking for a daily or even monthly batch file to create the folders and sub folders on a server share.

I wound up finding a solution that worked for me.  It is simplistic.

I wound up just using excel to create the folder structure.  Column A was the MD command.  Column B was my folder.  Column C was a sub folder.  Column D was my date.  It was easy to drag down the column to get my consecutive dates.  I exported the whole thing as a text file and ran it as a batch.  

It's not completely automated but I could set up a decade of folders in a few minutes.  

I'm going to check out SemperPhi's solution just to increase my knowledge of the subject.
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
Microsoft Legacy OS

From novice to tech pro — start learning today.

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.