?
Solved

how to use robocopy when getting errors

Posted on 2014-03-11
8
Medium Priority
?
546 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 85

Assisted Solution

by:oBdA
oBdA earned 1500 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 500 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
Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

 
LVL 85

Assisted Solution

by:oBdA
oBdA earned 1500 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 85

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 85

Assisted Solution

by:oBdA
oBdA earned 1500 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

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Question has a verified solution.

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

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…
VALIDATING DATES One method of validating dates is to jam the date into the DATE command and see if it accepts it by examining the system's errorlevel value. A non-zero result indicates failure. A typical example might look something like the fol…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Screencast - Getting to Know the Pipeline
Suggested Courses
Course of the Month14 days, 21 hours left to enroll

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