5

When using robocopy windows utility, what flags do I set so that robocopy aborts on the very first error it sees, similar to xcopy /dry command?

I need to mirror two dirs, and on occasion some files would be locked. I do not want robocopy to continue trying to copy files, or override the files that are not locked - rather the very first error should stop the whole copy process.

UPDATE:

I already have the /R set to 0 - unfortunately that it only applies to a single file, NOT to the whole copying process. Hence, the first file is ignored (instead of stopping the copying), but subsequent files are copied.

1
  • robocopy is a windows command that performs file copy operations and extends copy and xcopy functionality. It ships with the windows SDK which is included in several software distributed by Microsoft. I think this is the correct forum.
    – A Dwarf
    Commented Oct 7, 2009 at 23:00

2 Answers 2

1

Use the Retries argument and set it to 0:

/R:0

Robocopy will not retry if an error is found and the command is aborted. What you are experiencing is the fact this option is set by default to 1 thousand, or something similar.

As an added note, you can save the retries option to the registry which I believe may be useful in your case. This will save you from having to remember to set it to 0 every time and feels more natural, since you may want to explicitly tell robocopy to retry n times, instead of having to explicitly tell robocopy to not retry.

/R:0 /REG

Use /REG when applying /R: and that setting will be saved to the registry for future use.


If you wish to abort the whole robocopy operation, I'm afraid this isn't possible under robocopy. Not to my knowledge at least.

You will in that case want to use XXCOPY and the /C0 option.


Robocopy philosophy (being a replication tool) stops it from doing this... well, in my view at least until rollover is implemented.

0
0

We are using an extension to ROBOCOPY called RoboCopyPlus (www.robocopyplus.com). It adds emailo notification and condenses the log files and attaches them to the email. It adds a whole heap of switches to the standard set of ROBOCOPY switches. Not sure if it woudl do what you're looking for but I'd give it a try.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .