[X4U] Duplicate files

Eugene list-themacintoshguy at fsck.net
Mon Nov 28 23:36:18 PST 2005


On Mon, Nov 28, 2005 at 12:29:40PM CST, Charles Howse <chowse at charter.net> wrote:
: Richard Gilmore <rgilmor at uwo.ca> wrote:
: >
: > The files have the exact same names unless iPhoto renames without telling
: > me. But iPhoto has put them into different folders. I wouldn't have imported
: > so many photos but I thought iPhoto was supposed to check and see if you
: > were importing the same photo more than once.
: 
: I would post to the [X-Unix] list on this server, and ask for help there.
: Someone can surely help you with a shell script that will do exactly what
: you need.
: I played with it a bit, and I'm sure it can be done, though I didn't quite
: get there in the limited time I've played with it.  :-)
: 
: You need something akin to:
: $ find ~/Pictures -name '*.jpg' (but only output the part of the filename
: after the last '/', i.e. holiday.jpg); then write that to a file, sort the
: file, uniq -d the file for duplicate lines.  There's your list of dups, then
: you can act on that to backup the files.

This one-liner pretty much does it:

	find . -name '*.txt' -print0 | xargs -0 basename | sort | uniq -d

Hope this helps.


-- 
Eugene
http://www.coxar.pwp.blueyonder.co.uk/


More information about the X4U mailing list