How to export albums to folders from Apple Photos?

While I quite like the ‘new’ Photos interface as compared to Apple’s previous iPhoto, I was horrified to discover that it was no longer an option to directly export the photos to their individual albums but as ‘Moments’ instead. Thankfully a kind member has shared a technique to achieve this function that Apple has wilfully omitted.

  1. Launch ‘Script Editor’ application.
  2. Copy and paste the following into the editor;
  3. set dest to "/Users/USER/Documents/" as POSIX file as text -- the destination folder (use a valid path)

    tell application "Photos"
    with timeout of 10000 seconds
    repeat with i in albums
    set tFolder to dest & (get name of i)
    my makeFolder(tFolder) -- create a folder named (the name of this album) in dest
    export (get media items of i) to (tFolder as alias) without using originals
    end repeat
    end timeout
    end tell

    on makeFolder(tPath)
    do shell script "mkdir -p " & quoted form of POSIX path of tPath
    end makeFolder

  4. Rename USER to your Mac’s user directory name.
  5. Run the script.
  6. Select the albums you want to export and click OK.
  7. All the albums will be exported as folders to the Documents folder