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.

Possible Duplicate:
Folders named as the current month by command line

I have this code :

 xcopy  "C:\30*.zip"  "C:\Folder\"

what i want is to copy the zip files to a new folder, this folder named as the current month

ex : March , April

I'm using Windows Server2008 R2.

share|improve this question
    
Thanks @bobbymcr –  Mahmoud AL-saadi Dec 25 '11 at 8:30
add comment

migrated from stackoverflow.com Dec 27 '11 at 3:18

This question came from our site for professional and enthusiast programmers.

marked as duplicate by studiohack Feb 16 '12 at 15:04

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer

You can retrieve the month as

@For /F "tokens=2,3,4 delims=/ " %%A in ('Date /t') do @(

Set Month=%%A

Set Day=%%B

Set Year=%%C ) @echo Month = %Month%

But remember this depends on the regional date format.

Then you can create folder

MD Month . and copy the zip in the new Month folder created

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.