I have a bunch of albums in Apple Photos. How can I export them as folders so that I have a structure like the one below?

All photos
 - album 1
 -- photos of album 1
 - album 2
 -- photos of album 2

What I've tried so far:

  • Export photos with albums as names: this just creates one big folder with all the photos in it
  • Create folders for each albums and drag and drop photos in them: the metadata is gone (date etc.)

Ok, I have been combing the web for a similar solution as I really find Photos a poor replacement for Aperture.

This is an AppleScript script I put together based on various bits picked from similar questions but which they didn't do exactly what I needed. I can tell you that this one works with OS X El Capitan, Apple Photos and my 70 GB of pics and videos, I added a few error checking steps, it might be done more elegantly so any feedback more than welcomed. The reason it has the logic for picking albums based on the name is that otherwise the routine would go through all the albums, including default ones and export everything. I do use YYYY as start of each album so it is easy to select which ones I want to export. Possibly you can look for how to check for the parent folder or some other logic to ensure the script iterates over the right ones.

--AppleScript to export albums from Apple Photos
--Works with OSX El Capitan, Photos V1.3
--Usage: populate the initial variables with the folder to export to.
--It will create it in the desktop but you can use the alternative way 
--to create it anywhere).
--Also populate the list of prefixes to look for.
--The script searches for them followed by a space, I use YYYY as 
--prefix of all my albums. You may need to add your own logic there.

set theFolderName to "Exported Photos"
set albumprefixlist to {"2014","2013","2010"} -- Example list
set theDestinationRootFolder to POSIX file (POSIX path of file ((path to desktop as text) & theFolderName & ":")) as text
--set theDestinationRootFolder to "/Users/[username]/Desktop/Exported Photos" as POSIX file as text -- sets the destination folder (use a valid path)  
tell application "Finder"
    if not (exists theDestinationRootFolder) then
        my makeFolder(theDestinationRootFolder)
        log "Created root folder:" & theDestinationRootFolder
        log "Root Folder already exists:" & theDestinationRootFolder
    end if
end tell
tell application "Photos"
    repeat with i in albums
        set tAlbum to get name of i
        set tFolder to (theDestinationRootFolder & tAlbum) as text
            set nYear to text 1 thru ((offset of " " in tAlbum) - 1) of tAlbum as integer
        -- We use try here because in many cases there will be an error converting to integer

        end try
        set tYear to text 1 thru ((offset of " " in tAlbum) - 1) of tAlbum
        if tYear is in albumprefixlist then
            -- This checks the list, other tests can be done
            -- Alternative:if tAlbum begins with "2010" then
            -- Alternative: if nYear < 2010 then
            log "Processing " & tAlbum
            if (count of media items in i) > 0 then
                log "Exporting " & tAlbum & " to: " & tFolder
                tell application "Finder" to set fileExists to exists my POSIX file tFolder
                if not fileExists then
                    my makeFolder(tFolder) -- create a folder named (the name of this album) in dest
                    tell application "Photos"
                            export (get media items of i) to (tFolder as alias) with using originals
                        on error
                            log "Error with the export command, check the album's content"
                        end try
                    end tell
                    log "Error, folder exists, rather not export there"
                end if
                log "Skipping export as it is an Empty album"
            end if
            log "Skipping album " & tAlbum
        end if
    end repeat
    log "Process completed"
end tell
on makeFolder(tPath)
    do shell script "mkdir -p " & quoted form of (POSIX path of tPath)
end makeFolder
  • This is perfect. Works on Sierra too. Do we have similar script for Aperture too? I need to iterate all projects and all albums in them. @whydoesntwork
    – S Khurana
    Nov 5 '19 at 19:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .