file check

Nigel Rantor wiggly at wiggly.org
Tue Jul 15 12:22:28 BST 2008


Peter Corlett wrote:
> On Tue, Jul 15, 2008 at 11:38:24AM +0100, Nigel Rantor wrote:
>> Christopher Jones wrote:
>>> What's the quickest/easiest way to check that two large (~5Gb) files 
>>> are identical?
>> Check to see if the indoe's are the same.
> 
> *grin*
> 
> You do also get to hope that (st_dev, st_ino) is unique, which is not at all
> guaranteed once NFS joins the party.

Yes, I suppose I should have qualified that they must be on the same 
filesystem. I only mention it in case the OP was being tricksy rather 
than really wanting to know how to do it.

>> Otherwise use cmp, as others have said using a hash is slower than cmp,
>> and doesn't tell you if they're the same, only if they're different.
> 
> Hashing will however work out quicker for the more typical problem of having
> a bunch of files and wanting to know if there are any duplicates.

Indeed, but this was not what the OP wanted, and is therefore beside the 
point.

   n


More information about the london.pm mailing list