how I hate duplicates
My iBook’s hard-drive kept filling up and no amount of df, du magic would tell me what’s taking up all this space: 40GB (Yeah, it’s 3 years old so back off Mr 100 TB ).
Well, today I found out when I kicked open iPhoto to import some pictures from my camera - Yes! Duplicates. Libraries upon libraries of duplicates and triplicates, with each file approx. 1MB large.
I went rooting around and it turns out iPhoto, iTunes have both been creating several copies of the same file on my laptop.
So, I blew them away. How?
io2:~ io2$ cd /Users/io2/Pictures/iPhoto\ Library/
io2:~ io2$ find . -name *.JPG -print | awk '/_[0-9]\.JPG$/' |xargs rm -
Of course no sooner had I done that and twittered about it than Dustin Breese replied with a shorter version.
find . -name \*_[0-9].JPG -exec rm {} \;
Remarks
I totally envy those unix guys with their powerful (perl + awk + sed + pipes + shell) toolbox sitting in their castles looking down at the rest of us