Library consolidating aperture 3 ass

Friday, September 08, 2017 by Mdaf


Adventures merging Aperture 3 libraries

In our family we take a few photos, and they end up in different places. Two of those places are two laptops and two separate Aperture libraries. Two years ago I took the plunge and merged the libraries using Aperture’s library merging feature (to say nothing of the prior migration from iPhoto). I then used Duplicate Annihilator to remove duplicate photos, and generally tidied up my libraries. I then left both laptops with a copy of the same Aperture library (containing photos from 2011 and on, as my SSD couldn’t cope with much more).

Spin forward to 2013 when it once again seems prudent to take stock of our photos. Attempting to take the two Aperture libraries and merge them results in an error:

The library could not be imported because it is a duplicate of the library currently running.


After attempting various tricks, including importing one library into a fresh library, I was unable to use Aperture to merge the libraries. I was able to add one library to the other, however then I’d have an enormous number of duplicates to delete and it felt like it introduced some unpredictability into the result… deleting duplicates feels like a last resort to me rather than part of the plan.

Time to start hacking.

Aperture libraries are packages, which are just disguised folders, and they contain masters, which are the original files. Using a few UNIX tools I decided to find all of the files in library B that are also in library A, at the exact same path in the masters folder, and remove them. This is based on the assumption that our libraries were exactly the same until they diverged. Obviously if both libraries have imported new photos separately I will end up with duplicates. Hopefully not too many.

Here is the simple script I wrote to first find all of the masters in library A and then to delete them. BACKUP YOUR LIBRARIES FIRST.


pushd “$LIBRARY_A”
find Masters -type f | while read i; do
    if [ -f “$LIBRARY_B/$i” ]; then
        rm “$LIBRARY_B/$i”

This runs pretty quickly. When it’s done LIBRARY_B is smaller than it was. It is also a slightly broken Aperture library, in which a lot of originals are missing. To remove those broken images you need to open the library, hold down the option key and choose Generate Previews from the Photos menu (while not having any photo selected). Aperture will take a while, but it will go through all your photos and notice that ones that are missing. Once that process is complete, filter your library for “File Status” of “missing” and then delete those photos.

You still can’t import B into A, as Aperture will give the error mentioned above. But you can now import B into a new library. Then finally you can import that new library into A and then set about resolving any duplicates you did in fact end up with.

This was posted 5 years ago. It has 0 notes.