Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to move the contents of a folder say C:\MyContent to another folder say C:\April-13-03_163000. The destination folder should be created at the time of move based on the timestamp. The format of the folder should be MONTH-YY-DD_HHMMSS.

I have created a batch script for with the help of this

for /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set mydate=%%b-%%c-%%a)
for /f "tokens=1-2 delims=/:" %%a in ('time /t') do (set mytime=%%a)
mkdir C:\%mydate%_%mytime%
move C:\MyContent\*.* C:\%mydate%_%mytime%\ /y

But the above script is creating the folder as 04-2013-03_1630. How to get the desired naming format?

share|improve this question
up vote 1 down vote accepted

Simpler way would be adding the following:

if %bb%==01 set bb=January
if %bb%==02 set bb=February

and so on before the set mydate=%%b-%%c-%%a command. There are probably more neat solutions, but this should be good.

share|improve this answer

Your Answer


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.