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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sample robocopy scripts 1

Status
Not open for further replies.

icemel

MIS
Oct 17, 2005
463
US
Hi,

Can anyone share w/ me their tried and proven robocopy scripts for moving backup files from one location to another?

I am running robocopy from within an EM job... but they fail at least 75% of the time... I am wondering if my syntax is missing something critical.

THANKS much
 
Something like this.

Code:
robocopy d:\mssql\mssql\backup d:\temp\delete /z /MINAGE 2
That's the kind of script that I use to move the older files into a temp folder for deleting.

You'll need to play with robocopy a little. Depending on if there are files in the destination the result code from robocopy will change.

Denny
MCSA (2003) / MCDBA (SQL 2000)

--Anything is possible. All it takes is a little research. (Me)
[noevil]
 
Hi mrdenny,

What is "/MINAGE 2" ?

What would the syntax be if you only want to copy ONE file?

Thanks
 

I guess the syntax should be:

robocopy d:\mssql\mssql\backup\myFile d:\temp\delete /z /MINAGE 2

Denny, am I right?

"/MINAGE 2" means the frequency will be 2 days. Note this 2 should be : 2 x 24 x 3600 seconds. Any period less than that the action won't happen.



 
I think it should be:

robocopy d:\mssql\mssql\backup d:\temp\delete MYFILE /z

There's a guy here who says you can't do it this way, that you can only specify EXCLUDED files, by using the \XF switch:

for example:

robocopy d:\mssql\mssql\backup d:\temp\delete /z /XF EXCLUDED FILES

but I think this is totally misinformed.........
 
You can include files by putting them in forectly after the destination. The "/MINAGE n" copies all files that are older then n days.

Denny
MCSA (2003) / MCDBA (SQL 2000)

--Anything is possible. All it takes is a little research. (Me)
[noevil]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top