> 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: Very nice, Eugene! The 'basename' argument is what makes it work! -print0 and -0 allow whitespace in the file names. [charles at larry:~]$ find ~/Pictures -name '*.jpg' -print0 | xargs -0 basename | sort | uniq -d 823167-R1-17-8.jpg 823167-R1-20-5.jpg 823167-R1-21-4.jpg [charles at larry:~]$ I have 3 dups on my system. Now all I have to do is trash 'em. :-)