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
link|improve this question
I don't think xcopy supports that. You should try powershell. – kinokijuf Dec 25 '11 at 8:35
PowerShell supports xcopy... – soandos Dec 25 '11 at 8:48
feedback

2 Answers

up vote 0 down vote accepted

Here is a clunky way of doing it in powershell:

$a = "C:\Folder\"
$a +=get-date -format MMMM
xcopy "c:\30*.zip" $a /I
link|improve this answer
Thank you so much @soandos, but he ask me : "Does C:\New Folder\New Folder\December specify a file name or directory name on the target (F = file, D = directory)?" how to skip this? – Mahmoud Alsaadi Dec 25 '11 at 9:33
because i want to add it to schedule task – Mahmoud Alsaadi Dec 25 '11 at 9:36
added /I. That should do it. – soandos Dec 25 '11 at 9:37
its work, thanks alot – Mahmoud Alsaadi Dec 25 '11 at 9:39
feedback

For another command script way to do this, using JP Software's TCC/LE, simply use the %_MONTHF implicit environment varable and the ordinary copy command. It's a one-liner:

copy /MD C:\30*.zip C:\Folder\%_MONTHF\

Further reading

link|improve this answer
Thanks man .. its useful – Mahmoud Alsaadi Dec 26 '11 at 4:36
feedback

Your Answer

 
or
required, but never shown

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