Re: Finding Duplicat files?
MrPaulAR <[email protected]> Sat, 2 Nov 2002 10:41:18 -0600
| Newsgroups | gmane.linux.gentoo.newbies |
|---|---|
| Message-ID | <[email protected]> |
Hello Bob, Saturday, November 2, 2002, 8:32:10 AM, you wrote: BP> Is there a program that will tell me of duplicate files on my system? BP> For example the same file size and name but in different directories. I found this on http://groups.google when searching for "find dupicate files group:*linux*" The url is http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&safe=off&selm=AFACB7989668EEE10%40albooth.demon.co.uk Text is: In article <[email protected]>, [email protected] (James Gardiner) wrote: >I am looking for a utilitie that find duplicate files by content rather >than just name. Has anyone know of any? The only ones I have seen that >are any good appear to be Windows versions. > >Regards > >James James, This is my first attempt at it, but it seems to work: find . -type f -exec sum --sysv {} \; | sed 's/\..*\///' | sort | uniq -d In summary: find from this directory down all normal files and calculate the checksum and filesize (in blocks) for them (sysv version of sum used in order to get filename printed) filter list of checksums and files to remove path sort remove non repeated entries This will therefore find identical files with identical names in all directories below (and including) the current (permissions allowing). This could be done a lot better in perl (the problem with the above is that you're not given the files pathname at the end), but it wouldn't fit in one line then! This will take ages if you do it from / - you may want to try it on one filesystem at a time. Cheers, Andy Booth. -- Best regards, MrPaulAR mailto:[email protected]