Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does robocopy retries 1000000 times?

Tags:

robocopy

I get a couple of legacy bat scripts used for files synchronization. They use robocopy. According to the documentation, by default, there's a retry mechanism : one million retries, 30 seconds between retries.

So, if I understand well, if something is going bad (for instance not enough disk space in the destination folder), the script will run during approx 347 days before it ends.

I do appreciate that a retry mechanism exists, but I don't understand why the default behaviour is like that.

Default parameters values are supposed to match common and basic use cases, and for a file copy, I don't see the point of retrying almost forever; I mean, if it still does not work after, let's say, 5 times, it means that something somewhere should be fixed (network down, disk dead...), it worth stopping and raising an error.

What could be the reasons for such default behaviour ?

like image 987
irimias Avatar asked Aug 16 '17 07:08

irimias


People also ask

How many times will robocopy Retry?

Retry options Specifies the number of retries on failed copies. The default value of n is 1,000,000 (one million retries).

How do I stop robocopy from retrying?

It seem that there is no command way to stop or pause the robocopy process. For getting errors, you can set the "/R:n" to change the number of retries. For control the running time of robocopy process, you can try the "/RH" and "/RF" to run the copy process in specific hours and copy files "per file" instead.

What is better than robocopy?

The best alternative is FreeFileSync, which is both free and Open Source. Other great apps like Robocopy are TeraCopy, rsync, FastCopy and Bvckup 2.

Is robocopy faster than copy and paste?

Windows 7 and newer versions come with a new version of the robocopy command that is able to copy files much faster then the normal copy command or copy function of the file explorer by using several simultanious threads. So if you plan to copy a large number of files, e.g. to make a backup, use the robocopy command.

What is the default wait time for Robocopy retries?

Wait time between retries: default is 30 seconds. The amount of time robocopy will wait before attempting a retry. Save /R:n and /W:n in the Registry as default settings. Saves the number of retries and the wait time as the default in the registry. Wait for sharenames To Be Defined (retry error 67).

What is Robocopy and why should I Care?

Strive not to be a success, but rather to be of value. Robocopy (aka “Robust File Copy”) is a very useful command-line directory and file replication tool that replaces and enhances the functionality of Xcopy, adding a slew of valuable options, especially when it comes to file synchronizations, mirroring and file backups in general.

How can I improve the performance of Robocopy?

The following options will change the performance of robocopy: /J : Copy using unbuffered I/O (recommended for large files). /NOOFFLOAD : Copy files without using the Windows Copy Offload mechanism. /R:n : Number of Retries on failed copies - default is 1 million.

Why did Robocopy fail to copy any files?

Robocopy did not copy any files. Either a usage error or an error due to insufficient access privileges on the source or destination directories. Need to run a robocopy job against multiple machines?


1 Answers

the answer to "What could be the reasons for such default behavior ?" that i believe your searching for is poor design.

however - i would suggest that the intention for this default behavior is users expectations that robocopy will be 100% when it is completed. skipping means that the copy is incomplete. state of file permissions and locks are in the administrators care to ensure success, otherwise the options are available to change. this command is not for general consumption and is targeted for admins.

to mitigate this issue, use the /r: and /w: options to change them to something reasonable for your use case.

eg.

robocopy /r:3 /w:10 c:\src c:\dest

would copy c:\src to c:\dest with 3 retries of 10 seconds on issues it may need to retry on.

your own documenation link shows these options

like image 105
2114L3 Avatar answered Sep 28 '22 01:09

2114L3