http://qs1969.pair.com?node_id=803797


in reply to Re^5: Assistance with file compare
in thread Assistance with file compare

just compare the file sizes. Then only compare (or md5) files whose sizes match.

Not quite. If you need to be absolutely sure the files are identical, the following are effecient ways of achieving this:

  1. Identify files with the same file size.
  2. Of the files with the same file size, identify the files which are identical.

or

  1. Identify the files with the same hash.
  2. Of the files with the same hash, identify the files which are identical.

or

  1. Identify files with the same file size.
  2. Of the files with the same file size, identify the files with the same hash.
  3. Of the files with the same file size and hash, identify the files which are identical.

If you're dealing with many files, the second method is probably the best.
If you're dealing with just a few files, the first method is probably better.