Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --backup export option #1752

Open
RhetTbull opened this issue Dec 8, 2024 · 5 comments
Open

Add --backup export option #1752

RhetTbull opened this issue Dec 8, 2024 · 5 comments
Labels
cli Pertains to the command line interface feature request New feature or request

Comments

@RhetTbull
Copy link
Owner

Add a --backup option that exports with all settings needed to easily re-import the library to re-create it.

osxphotos export --backup /path/to/backup would be sufficient to create a full backup with edits, AAE, etc.

See #1751

@RhetTbull RhetTbull added feature request New feature or request cli Pertains to the command line interface labels Dec 8, 2024
@oPromessa
Copy link
Contributor

Would it also make sense for sync --import to use a database from an export ? Thus avoiding two steps: export and sync --export ?

@RhetTbull
Copy link
Owner Author

Would it also make sense for sync --import to use a database from an export ? Thus avoiding two steps: export and sync --export ?

Yes, that would be a good option. I'll open a separate issue. For this issue, I'd also add osxphotos import --backup to import from the backup.

@yatesco
Copy link

yatesco commented Dec 14, 2024

hiya - I'm looking for exactly this. I want to treat Photos as a black box and want the security of an independent copy of the (~250GB) database "just in case". I can't simply copy/backup the actual folder because of optimised images, so this looks perfect.

I'll be blunt - having read through the docs and the linked issue I have very little idea of how to achieve this ;-). I simply want a backup for disaster recovery, and whilst this looks like it is more than powerful enough, the cognitive load between a higher level osxphotos export --backup /path/to/backup and the current magic incantation is simply too much for a simple brain :-).

What would you suggest a safe starting point set of options would be?

Thanks!

@RhetTbull
Copy link
Owner Author

RhetTbull commented Dec 15, 2024

@yatesco The following config file should work. Save the photos_backup.toml file to your Pictures folder then you can run osxphotos via:

osxphotos export /path/to/export --load-config ~/Pictures/photos_backup.toml

The contents of the TOML file with annotations are:

[export]
download_missing = true # download missing photos from iCloud, remove if not using iCloud
export_aae = true # export .AAE sidecar files for re-creating edits in Apple Photos
export_by_date = true # export in YYYY/MM/DD/ format
not_shared = true # skip photos in shared albums
preview_if_missing = true # export preview if original is missing
ramdb = true # use in-memory database for faster processing with external disks
sidecar = [ "xmp",] # export sidecar files in XMP format
touch_file = true # touch file to set modify date to photo date
update = true # update the export with any changes made in Photos since the last export

photos_backup.toml.zip

If you want the backup to also sync deletions (delete photos from the backup that were also deleted in Photos since the last backup), then add this line to the toml file:

cleanup = true

These settings will give you enough data to preserve all metadata (titles/captions/keywords, etc) and recreate the Photos library if something catastrophic happened.

@yatesco
Copy link

yatesco commented Dec 15, 2024

awesome - thanks @RhetTbull

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli Pertains to the command line interface feature request New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants