Forum Moderators: coopster & phranque

Message Too Old, No Replies

help with xcopy

how to name files suing the current date

         

aspdaddy

8:02 am on Sep 28, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member




Hi i am scheduling this script each week, but would like to store previous versions on teh same drive, at present it overwrites. Is there any way to name the folder using the servers date

xcopy C:\Inetpub\*.* E:\Backup /E /V /C /F /H /R /Y

rocknbil

12:18 am on Sep 29, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Whoooo boy my BASIC is really rusty, but you should be able to do

xcopy [source] [destination] [switches]

If it's scripted with perl, do a localtime command, extract a satisfactory string, and build the dir to use as destination:

($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$months++; # January being month 0
$loc = qq¦E:\Backup\bu_$mon-$mday-$year\¦;

Hmm in retrospect you may have to execute mkdir to create the dir first . . .