Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Xcopy help

Status
Not open for further replies.

UKITC

Technical User
May 17, 2004
22
GB
Hi all,

Need a bit of help with some Xcopy work I am doing. I have got an xcopy job that runs and it fine, outputs the copy results to a text file and I am happy with how it is working.

I want to change the job now though. instead of over-writing the destination folder eachtime, if possible I want to job to create a new folder. here is the tricky bit, I want it to put the date in the new folder name. And then I want to run the job each day and the date to change accordingly.

anybody got any ideas??
 
Use something like:

SET FOLDER=%DATE:~4,4%%DATE:~7,2%%DATE:~10,4%
MD %FOLDER%
XCOPY sourcefile destfile /s > %FOLDER%\output.log
SET FOLDER=

-Note that my setup is for UK dates, you will need to switch the day and month over to retrieve US format dates.

John
 
ok I changed it to include my sourcefile and destfile but there was no file copy.....

SET FOLDER=%DATE:~4,4%%DATE:~7,2%%DATE:~10,4%
MD %FOLDER%
XCOPY D:\DATA\MANCHESTER\ J:\MANCHESTER BACKUP /S >%FOLDER%\OUTPUT.LOG
SET FOLDER=

I'm very new to this xCopy game...... [rednose]
 
I run a similar procedure for backup, this is what I do:

for /F "tokens=2-4 delims=/- " %%A in ('date/T') do set var= %%A%%B%%C

md %var%

cd %var%

xcopy e:\fcns8001 /e /h
 
can you please explain that to me?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top