Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .