29

I'm looking here for detailed info about how the algorithm of Robocopy determines whether a file has changed or not. If I use for example the /mir parameter, Robocopy must determine which files are changed and which not. Does it use the modified timestamp or file sizes, hashes a combination of all?

Interestingly, it says nothing about it in the documentation.

2 Answers 2

34

O.k. after spending the day researching this, reading the documentation, and testing for myself (all with the same result), I have the answer.

A short answer is: the default value of Robocopy is (unless you specify something different via parameters) that it will copy any file where the Timestamp OR the file size differs. Remember Robocopy ALWAYS copies from Source to Destination. So if you have a newer AND larger file in the destination, Robocopy will overwrite it with the older and smaller file from source (that's why I put emphasis on the word "differs" - it's not newer or larger, just different).

On a deeper level, you can check with the /it option even if attributes of a file differ and copy those that differ also - even if filesize and Timestamp are the same (O.K., for a 100%, I don't know if it will copy the file or only the missing attributes, but since the files are identical, the result will be the same).

I found the lengthy documentation which was quoted in the other thread - it is about the version XP010 (I guess it was Windows XP). But there is simply no newer documentation for robocopy. You can find the documentation here:

http://theether.net/download/Microsoft/Utilities/robocopy.pdf (Read the section "Using Robocopy File Classes", everything is laid out pretty precise there)

The documentation is about an older version of Robocopy (Under Win7 you usually have Version XP027) - but you can check for changes of the version on this site - which has a very neat overview:

http://yarcgui.wilkes.es/De/RoboCopy/index.htm

The bottom line is that there are not much differences between even XP and Win7 - only minor ones and the changes were to add parameters - not to alter them (with exception of the parameter /mir). And I think it's safe to say the mechanism of comparison won't have changed - since this would be a huge thing compared to the very small change of adding some more parameters.

This is probably the reason that there is no new documentation.

Hope that helps if you are looking for the same info and are reading this. I tried to be precise and did my research with care.

4
  • 3
    Does it use the created, modified, or both timestamps?
    – user643011
    Apr 15, 2018 at 15:29
  • @user54512 I don't understand at all.. so does it use timestamps or hashes?
    – Shayan
    Sep 27, 2019 at 13:11
  • 1
    @shayan: its written there, if Timestamp OR Filesize differs it will copy from source to destination. No hashes. Rest is in the documentation i put in the link.
    – user54512
    Sep 27, 2019 at 17:13
  • I think the /B option uses a checksum/hash to determine if changed Aug 4, 2023 at 10:28
0

My understanding is that a file is classed as changed if the timestamps are the same but the file size differs. If the timestamp changes, it's classed as older or newer.

You must log in to answer this question.

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