Re: Best way of identifying duplicate files in Cocoa
Re: Best way of identifying duplicate files in Cocoa
- Subject: Re: Best way of identifying duplicate files in Cocoa
- From: Jean-Daniel Dupas <email@hidden>
- Date: Fri, 16 Nov 2007 14:46:30 +0100
Le 16 nov. 07 à 14:25, Frank Reiff a écrit :
Another issue is of course performance. Comparing byte-by-byte is
certainly the simplest and most reliable way of doing this, but
it's SLOW.. on the other hand I don't really know what the
performance characteristics of an MD5, CRC32, or SHA hash are and
whether or not you need to read in the whole file contents to apply
them..
It would thus be great if somebody, somewhere had published a ready-
to-use - (BOOL) file: (NSString*) path isIdenticalTo: (NSString*)
path2; method :-)
I've spent the last two hours searching the web, but I haven't
found anything that comes close..
You don't have to check byte-by-byte if the two files have a
different size.
Then, comparing byte-per-byte is not so slow, as you can abort the
comparaison as soon as two bytes are differents.
Using a hash method has no benefit to compare two files on the disk.
It's only usefull if you want to compare a remote file (with
precomputed hash) and a local file.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden