Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
    

1 Answer 1

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

 
discard

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.