Solved

how to use robocopy when getting errors

Posted on 2014-03-11
8
480 Views
Last Modified: 2014-03-18
robocopy s: t: /E


im trying to copy everything that's on drive S to drive T. but somewhere halfway im getting an error and keeps retrying after 30 seconds. how can i just have it bypass any errors and continue ?

thanks
0
Comment
Question by:ttrbrtsn
  • 4
  • 2
  • 2
8 Comments
 
LVL 84

Assisted Solution

by:oBdA
oBdA earned 375 total points
ID: 39920430
Use /r:nn (retry nn times) and /w:nn (wait nn seconds) to define what happens on errors. In a reliable LAN or a local copy, you can usually use /r:0.
0
 

Author Comment

by:ttrbrtsn
ID: 39920442
so the syntax would be ??? this will try once and if it fails, move on to the next file ?

robocopy s: t: /e /r:0
0
 
LVL 13

Accepted Solution

by:
Santosh Gupta earned 125 total points
ID: 39920446
Hi,

use below command, /R:3 is used for only 3 tries as The default value of N is 1,000,000 (one million retries).

Robocopy /S /E /R:3  sourcePath destinationPath

http://technet.microsoft.com/en-us/library/cc733145.aspx
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 84

Assisted Solution

by:oBdA
oBdA earned 375 total points
ID: 39920459
ttrbrtsn,
yes, that's correct. The default values are somewhat unusable in a LAN.
If you want to check in a batch whether there were errors, use %ErrorLevel%; everything less than 4 is OK.
robocopy.exe ...
if %errorlevel% GEQ 4 (echo Robocopy encountered errors!).

Open in new window

0
 

Author Comment

by:ttrbrtsn
ID: 39920532
now lets say in 2 weeks, i want to copy the same source and target files BUT COPY ONLY what is NEW and has CHANGED. the entire directory is about 1.5TB large. i do not want to have to copy all 1.5TB again. the change or deltas should only be about 10GB max.

thanks
0
 
LVL 84

Expert Comment

by:oBdA
ID: 39920543
Just run the same command again. Robocopy will by default skip files that already exist in the target folder (you'll see these in the column "skipped" in the copy summary at the end).
If you want to remove files in the target that have been deleted in the source, add /mir to the arguments. This will make (pretty) sure that source and target will be identical after the copy. Without /mir, any files that have been deleted or moved in the source after the first copy will remain in the target.
0
 
LVL 13

Expert Comment

by:Santosh Gupta
ID: 39920546
use below switch.

/minlad:<N>
      
## Specifies the minimum last access date (excludes files used since N) If N is less than 1900, N specifies the number of days. Otherwise, N specifies a date in the format YYYYMMDD.

OR

/xo
      
## Excludes older files.
0
 
LVL 84

Assisted Solution

by:oBdA
oBdA earned 375 total points
ID: 39920604
Santosh,
there is no need for any additional arguments to "force" robocopy to skip existing files.
robocopy checks if a file with the same name, same date, and same size exists in the target, and if so, it will not copy this file again - by default.
/xo is superfluous in most cases and can actually be harmful:
Let's say a user edits a file on date Z, and this file gets copied in the first run to the other server.
Now the user finds out that whatever he did turned said document to garbage, and he restores the previous version from somewhere with date Y.
If the second copy now runs with /xo, the current (older) copy (as far as the user is concerned) will NOT be copied, because the garbage version on the other server is newer.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

One of my most closely kept secrets is revealed in this discussion How to output text on the same line This question was recently posted in EE by Simon336697 (http://www.experts-exchange.com/Programming/Languages/Scripting/Shell/Batch/Q_2459…
TOMORROW TOMORROW.BAT is inspired by a question I get asked over and over again; that is, "How can I use batch file commands to obtain tomorrow's date?" The crux of this batch file revolves around the XCOPY command - a technique I discovered w…

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question