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 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
share|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
add comment

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
share|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
add comment

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

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

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.