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.

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

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

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

closed as exact duplicate by studiohack Feb 16 at 15:04

This question covers exactly the same ground as earlier questions on this topic; its answers may be merged with another identical question. See the FAQ for guidance on how to improve it.

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

link|improve this answer
feedback

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