Why does Robocopy skip a changed file if file length and file date are the same?
I've been using Robocopy for a while to create a (quick) backup of my disks. The exact command I use is robocopy /MIR /R:0 sourcedrive:\ targetdrive:\sourcedrivename
.
This should create an exact mirror of all my files in a backup location, which for almost all files is the case.
Unfortunately I noticed that there is one large file which never gets copied since it's creation, despite the file being altered on several occasions. It's a 200Gb container, but neither the size of the container nor the OS date for the container ever get updated.
Why does Robocopy not update this file in the backup destination, and, more important, how can I get Robocopy to check and copy the file?
When I do an rsync from my backup destination to the next backup destination, rsync does pick up these changes.
I've found countless other posts, but none of them take into account that neither size nor date change for the file, therefor I created a new question.
Thanks.
Robocopy is a utility build with speed in mind. It will only check for filesize or date modified in order to detect change. If it were to do an md5 check on every file, the copier would be a lot slower.
Robocopy does not support this however.
This will lead you with a few options.
-
If you use a script, and robocopy is part of that script, make it delete that file before the copy starts so Robocopy will copy a new version to it.
-
Use another tool, such as TeraCopy that can do an MD5 comparison
-
Make sure the modified date is changed periodically. This can be done using powershell.
From personal experience my preference would be number 2, but it is up to you what you want. This answer is just to provide you with alternatives, given that Robocopy itself just does not support md5 comparisons and thus can't possibly find out if the file has changed by what was given to it. So either make enough changes to the environment such that robocopy will understand it, or use a different tool that does not need the environment to be changed for it to work.