Aperture 3 - AppleScript to Delete Referenced Masters on Network Drives
After reading an article on the new file handling capabilities of Aperture 3 I decided to give it a go. I had previously been using Lightroom 2 to edit photos but found the interface quite slow and not the nicest for organising many photos. For example I couldn’t sort the folder view by date. iPhoto didn’t have the level of editing capabilities I wanted and I disliked the idea of having a monolithic untouchable propriety library “file” storing all my photos. What if I wanted other apps to access my photo files over the network? What if I wanted to split my library up as I run out of space on my laptop? How would I share my libraries across macs?
The article mentioned that with Aperture 3 parts of libraries could be easily imported/exported, different libraries could be kept and switched between easily. In general it sounded very flexible. So my idea was to have my main Aperture library on a network drive to allow me to access it from either my mac book or mac mini at home. Unfortunately this was not possible as, rather frustratingly, Aperture 3 does not let you open or save libraries to network drives. Googling this showed up many other frustrated users as apparently this was possible with Aperture 2. However, I was surprised to see one post mention a workaround to store the library on the network, which ended up giving poor results - even on a Gbit network. So perhaps there is a reason Apple disabled this after all.
My solution is to use referenced masters stored on the network and keep the actual aperture library on the local disk. The library itself could be rsyned to the network drive and then back to either my mac book or mac mini when I want to make changes. I wouldn’t have the main library open on both machines at the same time. If I wanted to do that I would create a temporary library and then import it to the main library latter. The original photos would all be outside of the library and references held to their location on the network drive. When I’m not on my home network with my MacBook I could keep a copy of the referenced files on my local hard drive and re-point the references, but since previews of originals are kept in the library this would probably be sufficient for browsing photos away from home. Especially if the preview size is set to “keep within 1920″ (found in the settings of Aperture 3).
After having played with this setup for a few minutes I noticed a problem when wanting to delete referenced masters stored on a network drive from the library. Ticking the “Move referenced files to System Trash” resulted in an error “You don’t have access to the System Trash on the master files’ volume”. So I wrote an AppleScript to do this.
The script will delete the master originals of the selected photos from the mounted file system. You can then delete the link to them (which will become broken) from your library. I wanted to make the script just be an alternative to the empty trash button by removing all items in the trash but had trouble getting this to work. Therefore it just deletes the selected photos instead. If you select all photos in the trash before running the script this should be fine. Then delete them from the Aperture trash afterwards.
The script is heavily based on the “Find Master’s Location” script by Brett Gross but altered to work with Aperture 3. So many thanks to Brett. I had no idea until I saw his script that it was possible to directly query the Aperture database which is actually using SQLite.
Needless to say, please use this at your own risk. I’ve only tested it with my specific usage. My reference photos are stored on an ubuntu samba share and mounted at /Volumes/photos on my mac(s). Master’s icon available on deviantart.com
It is useful to turn on the Script menu for easy access to this AppleScript.
Ap3 Delete Selected Referenced Masters.scpt
Update: 15th March 2010 - The AppleScript has been updated to display a confirmation dialog box before starting and another dialog box when finished reporting how many files were deleted.
Tags: Aperture AppleScript

March 15th, 2010 at 12:40 pm
Thanks for the plug Jon!
I know that a lot of us Aperture users are fighting with the exact thing that you discuss here and I love that Aperture is extensible enough for enterprising souls to be able to make it work in our various workflows.