I made the mistake of importing my photo archive for over 11 years which I had organized by year and then by dated events from years of manual collecting with maybe 10-20 folders of photo "albums" per year. After importing where it "preserves" folder hierarchy to create Albums, I have two problems now.

First off, the way Photos makes albums from an import is beyond stupid as it creates this unnecessary level of folder nesting for each album so that every sub folder which contains just pictures gets converted to a folder level as named and then a single album of the same name! You'd think the last level of photos would be just albums, but no. I can't see how this is at all helpful. I would think all leaves at a folder level would be made an album inside its containing folder so folders would only be created if it contains a sub-folder. This... this is awful. If there was some way to get a "tree view" inside the album selection view I could at least manually fix this on a year-by-year basis by moving all albums to their appropriate year, but this is a no-go in the GUI as far as I can tell.

The other problem is that was using Picasa (SHAME!) years ago and I forgot that it pollutes your archive with thumbnails all over the place. I was able to get rid of all of the thumbnail photos using Gemini II which does photo matching (great tool for doing this, by the way) but now I have all of these albums named .@_thumb in every nested album along with each single album of a folders of the same name as I described, compounding the pain. The result is not only visually painful, the extra overhead seems to make Photos a total pig now. Apparently it does NOT like having so many Albums.

I tried using the command line to see if Album names show up in the Photos Library.photoslibrary hierarchy but either they are not listed there or not named by Album name. Trying find ~/Pictures/Photos\ Library.photoslibrary/ -name *thumb comes up empty. If I could only access the Albums by some descriptor I could probably fix this with some transformation script but as it stands I don't even know what the data structure is for Albums.

Any ideas?

  • Don’t edit or access the files inside the .photosLibrary bundle directly, you will ruin the archive and potentially make it unreadable. AppleScript can do this in a pinch. You can retrieve folder names, contents, move shit around. It’s good for importing and exporting customised folder structures too.
    – CJK
    Apr 17, 2019 at 15:50
  • Thanks for that. Glad I did not attempt that! I hadn't considered AS/automator. I still wonder how it will handle having an "@" in the title as I can see Photo's search doesn't know what to do with it. Hopefully there is a way to escape it as a var in AppleScript. Thanks!
    – Darf Nader
    Apr 17, 2019 at 21:17
  • 2 tasks: First, in the nested album hierarchy there are nearly 100 folders named .@_thumb with an empty album with same name in it. Second, a redundant folder was created . Example: photo in folder source ./2008/2008-02-14 - Valentines Day/IMG0123 was imported to be album named: Imported Albums/2008/2008-02-14 Valentines Day/2008-02-14 Valentines Day. Ideally, these albums could be moved up one directory and the now empty folder of the same name deleted.
    – Darf Nader
    Apr 19, 2019 at 4:33

1 Answer 1


Launch Script Editor and create a new script.

Deleting folders named ".@_thumb"

Copy and paste the following script into Script Editor.

use Photos : application "Photos"

run Photos

recurse(application "Photos")
repeat with F in flatten(result)
        delete F
    end try
end repeat

to recurse(_X)
    set _A to a reference to every folder of _X
    if not (_A exists) then return {}
    return (_A whose name = ".@_thumb") & recurse(_A)
end recurse

to flatten(L)
    local L

    if L = {} then return {}
    if L's class ≠ list then return {L}
    flatten(item 1 of L) & flatten(rest of L)
end flatten

Run the script (R).

The second issue you mentioned is trickier because of a bug in AppleScript that returns an incorrect reference to newly created albums. At the moment, I'm not sure of a workaround, but I will have a think and update this with any thoughts I glean.

  • 1
    Funny, I've scripted in bash, perl, and later ruby off and on for decades, but I never bothered to learn AppleScript. I've even long maintained personal setup scripts to make my workstation "profile" portable for over a decade. It started as POSIX-only for full compatibility and later I included GNU tools when Linux took over. Even after going MacOS I only use Homebrew-installed commands. I have no idea why I avoided AppleScript when I clearly should have been using it to configure my user account on a new machine! Thanks @CJK for this script AND opening my reluctant eyes! 8^D
    – Darf Nader
    Apr 27, 2019 at 0:57
  • Thanks- added all of that to my "Brain Food" list.
    – Darf Nader
    Apr 27, 2019 at 19:11

You must log in to answer this question.

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