Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Delete originals from iPhoto6 library via Terminal Apps
There was a neat utility that worked with iPhoto 5 (and below) called iPhoto Diet. This little AppleScript-based program let you delete all original photos from your iPhoto library (after backing them up, of course!), thus saving you lots of hard drive space. iPhoto diet no longer works for iPhoto 6, but typing the following commands in Terminal does the trick:
$ mkdir ~/.Trash/iPhoto-Originals
$ cd ~/"Pictures/iPhoto Library/Modified/"
$ find . -type f -exec mv "../Originals/{}" ~/.Trash/iPhoto-Originals/ \;
This set of commands creates a folder called iPhoto-Originals in the trash, and moves all of the originals to the trash, while keeping the non-modified originals in place. Just ignore the errors that show up in Terminal; they have to do with the fact that there are some photos in the modified folder (such as movie thumbnails) which don't have corresponding originals.

Credit goes to RicardoL for the solution.

[robg adds: For those who don't know how iPhoto works, whenever you modify a photo, iPhoto keeps a copy of the original, so you can always revert your changes. If you use this script, you'll save some drive space, but you won't be able to revert your changes any more. And as noted, please make sure you have a current iPhoto library backup before trying this hint -- there's nothing worse than losing a bunch of digital photos that exist in no other form!]
    •    
  • Currently 4.17 / 5
  You rated: 5 / 5 (6 votes cast)
 
[22,172 views]  

Delete originals from iPhoto6 library via Terminal | 13 comments | Create New Account
Click here to return to the 'Delete originals from iPhoto6 library via Terminal' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Delete originals from iPhoto6 library via Terminal
Authored by: rhowell on Jun 01, '06 08:33:42AM

One final step should be implemented for completeness, though its not entirely necessary:

Rebuild the iPhoto database by launching iPhoto while holding down the Option-Command keys.

I always removed all original photos in iPhoto 5 by hand. Upon importing my library into iPhoto 6, I had a number of duplicate "originals" and "modifieds" in the iPhoto Library folder. I believe iPhoto 6 was reading the old iPhoto 5 database and mistakenly believing I had all the originals, when I did not.



[ Reply to This | # ]
Careful of Video Files
Authored by: jingman on Jun 01, '06 09:06:16AM
Just a note: for some reason when iPhoto uploads videos from my camera (canon sd450) it sticks some of them in the "originals" folder. So maybe tweak the code so that it deletes only images? Couldn't hurt.

[ Reply to This | # ]
Careful of Video Files
Authored by: sjk on Jun 01, '06 04:39:56PM
Instead of cluttering my iPhoto library with video files I use Image Capture to import and delete them separately before importing the remaining images into iPhoto. And I can delete any unwanted images with IC, too.

[ Reply to This | # ]
Delete originals from iPhoto6 library via Terminal
Authored by: JaxMyers on Jun 01, '06 07:31:39PM

Hey I posted that!
I'm not anonymous! :)



[ Reply to This | # ]
Delete originals from iPhoto6 library via Terminal
Authored by: robg on Jun 01, '06 07:39:20PM

Not any more you're not :)

-rob.



[ Reply to This | # ]
Delete originals from iPhoto6 library via Terminal
Authored by: Doug45 on Jun 02, '06 10:07:37AM

I could not get this to work. It did seem to finally search through my iPhoto library after searching many other folders. When it finished, nothing was moved to the iPhoto Originals folder that was created in the Trash. And I have a lot of originals that have been modified. Any possible answers? I copied and pasted so I know I didn't type it incorrectly.

Thanks.
Doug Campbell



[ Reply to This | # ]
incorrect
Authored by: skochak on Jun 02, '06 10:52:33AM

the thirt command should be<p>

find . -type f -exec mv "../Originals/{}" ~/.Trash/iPhoto-Originals/ \;



[ Reply to This | # ]
incorrect
Authored by: robg on Jun 02, '06 11:18:06AM

I fixed this; it seems there's (sigh) a backslash issue with the new version of Geeklog. For those who have been here a while, I fought this for a LONG time with prior versions, but they had it licked in the 1.3.7 version. Now it seems to have returned in 1.4.0...

I'm working with the devs to get a fix as quickly as possible...

-rob.



[ Reply to This | # ]
incorrect
Authored by: skochak on Jun 02, '06 12:55:46PM

I was just surprised that even after so many comments, no one had noticed it..
Nevertheless.. great hint!!



[ Reply to This | # ]
Avoiding error messages
Authored by: JadeNB on Jun 02, '06 03:39:26PM

One way to avoid the errors is to wrap the find statement in a loop which runs through the arguments and tests for existence. That is, one can replace your second line with:

$ for x in `find . -type f`; do if [[ -e ../Originals/$x ]]; then mv ../Originals/$x ~/.Trash/iPhoto-Originals; fi; done

As with your suggestion, you need to be in the relevant directory to do this. There's probably a slicker way to do the testing within find, but I don't know it well enough to know how.



[ Reply to This | # ]
Delete originals from iPhoto6 library via Terminal
Authored by: miketyson on Jan 08, '07 08:13:52PM
A refined version which recreates the directory structure (with rolls), only operates on images (not videos) and avoids errors:

#!/bin/sh
echo "Trashing originals";
test -d ~/.Trash/iPhoto-Originals || mkdir ~/.Trash/iPhoto-Originals
cd ~/"Pictures/iPhoto Library/Modified/"
find . -type f -iname *.jp*g -exec sh -c '
   test -f "../Originals/{}" && 
      dir=`dirname "{}"` &&
      ( 
         test -d ~/.Trash/iPhoto-Originals/"$dir" || 
         echo mkdir -p ~/.Trash/iPhoto-Originals/"$dir" &&
         mkdir -p ~/.Trash/iPhoto-Originals/"$dir" 
      ) &&
      echo mv "../Originals/{}" ~/.Trash/iPhoto-Originals/"$dir" &&
      mv "../Originals/{}" ~/.Trash/iPhoto-Originals/"$dir"
   ' \;


[ Reply to This | # ]
Delete originals from iPhoto6 library via Terminal
Authored by: thomasbosboom on Oct 21, '07 02:14:38PM

Don't use this technique in iPhoto 08. it screws your library.
Although the actual removing works OK iPhoto does no longer display the modified photo if the original is missing. Even after a full library rebuild...


---
"Security is like an analogy. It only works up until the point that someone considers an angle or aspect that you haven't previously considered and accounted



[ Reply to This | # ]
Delete originals from iPhoto6 library via Terminal
Authored by: JaxMyers on Dec 11, '07 01:35:56PM

I made that mistake too. Good thing I backed up my library.



[ Reply to This | # ]