Guest DT Posted October 17, 2007 Posted October 17, 2007 Guys, I might be having a blonde moment but I recall in the past (have not used it for a few years) that Robocopy had the ability to mirror two folders, and update files based on the file dates in the two folders. That is, if for instance, we are sync'ing folder A and folder B and the file existed in both then the older of the two would be replaced. However I have setup the following: robocopy.exe \\server1\share\folder1 \\server2\share\folder2 /MIR This deletes anything on server2 that does not exist on server1 So I tried this: robocopy.exe \\server1\share\folder1 \\server2\share\folder2 /MIR /XX /LOG+:sync2nth.txt This does not delete anything BUT if a file exists on both servers the copy on server2 is overwritten no matter what the file date is. I am sure I've setup robocopy in the past to do a simple mirror and keep the newer version of any files that already exist. Can anyone help out? Thanks in advance Darren
Guest Pegasus \(MVP\) Posted October 17, 2007 Posted October 17, 2007 Re: Question on Robocopy "DT" <darren_todd@yahoo.co.uk> wrote in message news:%23UTk$tJEIHA.4296@TK2MSFTNGP04.phx.gbl... > Guys, > > I might be having a blonde moment but I recall in the past (have not used > it for a few years) that Robocopy had the ability to mirror two folders, > and update files based on the file dates in the two folders. That is, if > for instance, we are sync'ing folder A and folder B and the file existed > in both then the older of the two would be replaced. However I have setup > the following: > > robocopy.exe \\server1\share\folder1 \\server2\share\folder2 /MIR > > This deletes anything on server2 that does not exist on server1 > > So I tried this: > > robocopy.exe \\server1\share\folder1 \\server2\share\folder2 /MIR /XX > /LOG+:sync2nth.txt > > This does not delete anything BUT if a file exists on both servers the > copy on server2 is overwritten no matter what the file date is. > > I am sure I've setup robocopy in the past to do a simple mirror and keep > the newer version of any files that already exist. > > Can anyone help out? > > Thanks in advance > > Darren > I suggest you use /XO instead of /MIR /XX. Alternatively you can use xcopy.exe with the /d switch.
Guest Newell White Posted October 17, 2007 Posted October 17, 2007 RE: Question on Robocopy I use this for backing up selected folders from a fileserver with very brief log file: @ECHO OFF REM batch job to copy changed files from folder \\server1\share\%1 to E:\backserver1\%1 REM ECHO %date% copy %1 to backserver1 %time% >> %2 IF NOT EXIST E:\backserver1\%1 MD E:\backserver1\%1 ROBOCOPY \\server1\share\%1 E:\backserver1\%1 /e /xo /r:3 /w:0 /ndl /nfl /njs /njh /np ECHO ROBOCOPY errorlevel %errorlevel% >> %2 The /e option copies empty sub-folders to provide the mirror structure. -- Newell White "DT" wrote: > Guys, > > I might be having a blonde moment but I recall in the past (have not used it > for a few years) that Robocopy had the ability to mirror two folders, and > update files based on the file dates in the two folders. That is, if for > instance, we are sync'ing folder A and folder B and the file existed in both > then the older of the two would be replaced. However I have setup the > following: > > robocopy.exe \\server1\share\folder1 \\server2\share\folder2 /MIR > > This deletes anything on server2 that does not exist on server1 > > So I tried this: > > robocopy.exe \\server1\share\folder1 \\server2\share\folder2 /MIR /XX > /LOG+:sync2nth.txt > > This does not delete anything BUT if a file exists on both servers the copy > on server2 is overwritten no matter what the file date is. > > I am sure I've setup robocopy in the past to do a simple mirror and keep the > newer version of any files that already exist. > > Can anyone help out? > > Thanks in advance > > Darren > > >
Guest geek-y-guy Posted October 17, 2007 Posted October 17, 2007 Re: Question on Robocopy "Newell White" <NewellWhite@discussions.microsoft.com> wrote in message news:32AFDCD9-2EBA-4115-8BAF-E0AF03B5F648@microsoft.com... >I use this for backing up selected folders from a fileserver with very >brief > log file: > > @ECHO OFF > REM batch job to copy changed files from folder \\server1\share\%1 to > E:\backserver1\%1 > REM > ECHO %date% copy %1 to backserver1 %time% >> %2 > IF NOT EXIST E:\backserver1\%1 MD E:\backserver1\%1 > ROBOCOPY \\server1\share\%1 E:\backserver1\%1 /e /xo /r:3 /w:0 /ndl /nfl > /njs /njh /np > ECHO ROBOCOPY errorlevel %errorlevel% >> %2 > > > The /e option copies empty sub-folders to provide the mirror structure. > -- > Newell White Hi Newell: I'm new to robocopy and am interested in implementing it in the following scenario. I have a primary IIS6 server and I want to duplicate the website root on the server out to five load-balanced servers. Is the script above just a .BAT file that you're calling with scheduler? If so, would I use a similar syntax, just with five robocopy commands (one for each server)? Or is there a better way to push updates out to the 5 servers? TIA, AK > > > "DT" wrote: > >> Guys, >> >> I might be having a blonde moment but I recall in the past (have not used >> it >> for a few years) that Robocopy had the ability to mirror two folders, and >> update files based on the file dates in the two folders. That is, if for >> instance, we are sync'ing folder A and folder B and the file existed in >> both >> then the older of the two would be replaced. However I have setup the >> following: >> >> robocopy.exe \\server1\share\folder1 \\server2\share\folder2 /MIR >> >> This deletes anything on server2 that does not exist on server1 >> >> So I tried this: >> >> robocopy.exe \\server1\share\folder1 \\server2\share\folder2 /MIR /XX >> /LOG+:sync2nth.txt >> >> This does not delete anything BUT if a file exists on both servers the >> copy >> on server2 is overwritten no matter what the file date is. >> >> I am sure I've setup robocopy in the past to do a simple mirror and keep >> the >> newer version of any files that already exist. >> >> Can anyone help out? >> >> Thanks in advance >> >> Darren >> >> >>
Guest Newell White Posted October 18, 2007 Posted October 18, 2007 Re: Question on Robocopy "geek-y-guy" wrote: > > "Newell White" <NewellWhite@discussions.microsoft.com> wrote in message > news:32AFDCD9-2EBA-4115-8BAF-E0AF03B5F648@microsoft.com... > >I use this for backing up selected folders from a fileserver with very > >brief > > log file: > > > > @ECHO OFF > > REM batch job to copy changed files from folder \\server1\share\%1 to > > E:\backserver1\%1 > > REM > > ECHO %date% copy %1 to backserver1 %time% >> %2 > > IF NOT EXIST E:\backserver1\%1 MD E:\backserver1\%1 > > ROBOCOPY \\server1\share\%1 E:\backserver1\%1 /e /xo /r:3 /w:0 /ndl /nfl > > /njs /njh /np > > ECHO ROBOCOPY errorlevel %errorlevel% >> %2 > > > > > > The /e option copies empty sub-folders to provide the mirror structure. > > -- > > Newell White > > Hi Newell: I'm new to robocopy and am interested in implementing it in the > following scenario. I have a primary IIS6 server and I want to duplicate the > website root on the server out to five load-balanced servers. > > Is the script above just a .BAT file that you're calling with scheduler? If > so, would I use a similar syntax, just with five robocopy commands (one for > each server)? > > Or is there a better way to push updates out to the 5 servers? > > TIA, AK > > Yes I use scheduled .BAT jobs quite a bit. There is probably a better way, but the best can be the enemy of the good. Instead of having the master server push the updates to the secondaries, having each secondary try to pull them might be more robust. On our antique server Robocopy scans a folder containing 50k+ files totalling 6Gbyte in about a minute, so looking for updates when there are none is not a big drag. -- Newell White
Recommended Posts