On Saturday 19 February 2005 06:42 pm, Carlos E. R. wrote:
The Saturday 2005-02-19 at 00:01 -0600, Richard wrote:
Graham, I found a small utility on another list some time ago and it seems to do a pretty good job. It's a comman line thingie about 8 lines long. It'll do recursive checking and then list all the dups by groups so you can delete the ones you dont want. I found it useful to clean some crap off my drives.
It's only about 300 bytes small. If you want, I'lll send it to you as an attachment.
If it is an script, put it here, and we can all coment on it.
-- Cheers, Carlos Robinson
Ok Carlos, here it is. #! /bin/sh OUTF=rem-duplicates.sh; echo "#! /bin/sh" > $OUTF; find "$@" -type f -print0 | xargs -0 -n1 md5sum | sort --key=1,32 | uniq -w 32 -d --all-repeated=separate | sed -r 's/^[0-9a-f]*( )*//;s/([^a-zA-Z0-9./_-])/\\\1/g;s/(.+)/#rm \1/'
$OUTF; chmod a+x $OUTF; ls -l $OUTF
I have it in the /usr/local/bin directory as ckdups and to use it I go to a terminal window, su then cd to the directory I want to check out, then type ckdups and wait. Eventually there will appear a list of duplicate files. They are grouped together with a space between the groups. From the list you can delete the files you dont want to keep. Worked for me, hope it helps you. BTW, I should give the author proper credit but I cant remember where it came from and his name is not in the file. It's a neat thing and he should get credit, but .. . . . Sorry for not being able to give credit. Richard -- Old age ain't for Sissies!