Mac – Find all the backed up photos on Time Machine drives

backuppermissionphotosterminaltime-machine

I have several time machine backups. I want to get all the photos out of them and upload them to Google Photos. I believe the "Backup and Sync from Google" application will do this for me, once I find (and perhaps temporarily copy) my photos.

Although I can browse my Time Machine backups in the Finder, there are, again, lots of them, and the drives being backed up changed over time. I don't see scanning through them manually being viable if there is any automatic option possible.

I'm running macOS 11.1. I can't change into the backup directory or list things from the terminal, even as root:

/V/MacBack ❯❯❯ cd Backups.backupdb/
cd: Permission denied: 'Backups.backupdb/'
/V/MacBack ❯❯❯ ls Backups.backupdb/                                                                                                  Thu 11 Mar 07:10:07 2021
ls: : Operation not permitted

When I try to see all the settings applied to the folder, I get:

/V/MacBack ❯❯❯ ls -lfde@O Backups.backupdb/
drwxr-xr-x+ 7 clinton  staff  - 238 17 Mar  2019 Backups.backupdb//
 0: group:everyone deny add_file,delete,add_subdirectory,delete_child,writeattr,writeextattr,chown

I would be happy to strip the permissions (and restore them when I'm done, if possible). Supposedly chmod -a# 0 should work, but it doesn't:

/V/MacBack ❯❯❯ sudo chmod -a# 0 Backups.backupdb/
chmod: Failed to set ACL on file 'Backups.backupdb/': Operation not permitted

This answer seems close. I also tried to give myself access this way, after confirming my user id:

/V/MacBack ❯❯❯ sudo chmod +a# "clinton allow writeattr,writeextattr,chown" Backups.backupdb/ 
usage:  chmod [-fhv] [-R [-H | -L | -P]] [-a | +a | =a  [i][# [ n]]] mode|entry file ...
    chmod [-fhv] [-R [-H | -L | -P]] [-E | -C | -N | -i | -I] file ...

Perhaps I'm barking up the wrong tree. Maybe there's a utility that does this. I can see that I could restore files, but I'd run out of space quickly (unless I could only restore photos?), and it'd take forever.

How can I find all the photos in my multitude of backups (or, even all the photos in a single TimeMachine backup?)

Best Answer

Aha! Here's the answer: https://superuser.com/a/1591350/2684

On Big Sur (macOS 11), you need to go to System Preferences and enable Full Disk Access for the Terminal (or, iTerm, in this case). Then, magically, a command like:

chmod "-a#" 0 Backups.backupdb/

works just fine.


I also learned that chmod -N will removal all ACLs from a file, via https://superuser.com/a/299912/2684 .