Solved

how to use robocopy when getting errors

Posted on 2014-03-11
8
460 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 83

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
 
LVL 83

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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 

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 83

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 83

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Using dates in 'DOS' batch files has always been tricky as it has no built in ways of extracting date information.  There are many tricks using string manipulation to pull out parts of the %date% variable or output of the date /t command but these r…
YESTERDAY YESTERDAY.BAT is inspired by a previous article I wrote entitled: TOMORROW.BAT (http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/MS_DOS/A_4196-Advanced-Batch-File-Programming-TOMORROW-BAT.html). The crux of this batch f…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

746 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now