Velvet Star Monitor

Standout celebrity highlights with iconic style.

general

How to abort robocopy on first error

Writer Sophia Terry

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

2 Answers

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

We are using an extension to ROBOCOPY called RoboCopyPlus (). 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.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy