Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question

migrated from stackoverflow.com Oct 7 '09 at 22:27

This question came from our site for professional and enthusiast programmers.

    
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 Oct 7 '09 at 23:00
    
saw the update. edited answer –  A Dwarf Oct 7 '09 at 23:18

2 Answers 2

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.

share|improve this answer

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.

share|improve this answer
    
please read the update –  Yurik Oct 7 '09 at 23:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.