Operation Modes¶
Changed in version 1.8.0: Added --delete-after-download parameter
icloudpd works in one of three modes of operation. All three download assets from iCloud that are not in local storage yet; they differ in what they delete afterwards.
Mode |
Option |
What is deleted |
Where |
When |
|---|---|---|---|---|
Copy |
(default) |
Nothing |
- |
- |
Sync |
Local files of assets that are in iCloud’s “Recently Deleted” album |
Local |
After the download pass |
|
Move |
Assets that are present locally and at least X days old |
iCloud (moved to “Recently Deleted”) |
During the download pass, asset by asset |
Sync and Move can’t be combined: Sync would delete the local copies of the assets Move moves to “Recently Deleted”.
Copy¶
Download assets from iCloud that are not in local storage. Nothing is deleted, neither locally nor in iCloud.
This is the default mode.
icloudpd --directory /data/photos --username my@email.address
Sync¶
Download assets from iCloud that are not in local storage (same as Copy). In addition, delete local files of assets that were deleted in iCloud.
This mode is selected with the --auto-delete parameter.
When a photo is deleted in iCloud, Apple moves it to the “Recently Deleted” album. After the download pass, icloudpd goes through that album and deletes the matching local files.
This only works while the asset is still in “Recently Deleted”. Apple keeps assets there for about 30 days, or until the album is emptied. Once it is gone from there, icloudpd no longer knows about it and the local files stay.
The whole “Recently Deleted” album of the selected
--libraryis checked.--album,--recent,--until-found,--skip-videos,--skip-photosand the--skip-created-*filters don’t limit it.Local files are found by the name and folder icloudpd would download them to, so keep
--folder-structureand the naming options the same as when you downloaded. Files you renamed or moved are not found.Matching
.xmpsidecar files (see--xmp-sidecar) are deleted as well.With
--dry-run, the files that would be deleted are only logged.
icloudpd --directory /data/photos --username my@email.address --auto-delete
Move¶
Download assets from iCloud that are not in local storage (same as Copy). Then delete assets in iCloud that are in local storage, optionally leaving recent ones in iCloud.
This mode is selected with the --keep-icloud-recent-days X parameter.
Deleting means the asset is moved to “Recently Deleted” in iCloud, the same as deleting it on your phone. It is removed from the whole library and from every album it is in, not only from the album given with
--album.The age of an asset is calculated from its creation date (when it was taken, as reported by iCloud) in the local time zone. Assets younger than X days stay in iCloud. With
0, every asset that is present locally is deleted from iCloud.Deletion happens asset by asset while the download pass runs.
Safety rules. An asset is only deleted from iCloud if:
every file that was requested for it is present locally, after downloading or because it was already there. This includes the video of a Live Photo and every size given with
--size. If a size requested with--force-sizedoesn’t exist, or the requested--live-photo-sizedoesn’t exist, the asset is kept;iCloud reports a creation date for it. Assets without one are kept, with a warning;
it is not excluded by filters such as
--skip-videos,--skip-photos,--skip-created-beforeor--skip-created-after;the run looks at it. With
--recentor--until-foundthe run stops early, and the remaining assets stay in iCloud. icloudpd logs a warning at startup for these combinations;the run is not using
--only-print-filenames, which never deletes anything.
If iCloud refuses a deletion with TRY_AGAIN_LATER (for example because the library was changed at the same time), that asset stays in iCloud, an error is logged and the run continues. The next run tries again.
With --dry-run, the assets that would be deleted are only logged.
Note
With --skip-live-photos, the video part of a Live Photo is not downloaded, so Live Photos are not deleted from iCloud; a warning at startup says so. Before 1.33.1, they were deleted, video included.
icloudpd --directory /data/photos --username my@email.address --keep-icloud-recent-days 30
--delete-after-download¶
--delete-after-download is deprecated since 1.26.0; use --keep-icloud-recent-days 0 instead. It only deletes assets from iCloud that were downloaded in that same run. Assets that were already in local storage are not deleted.
Rejected combinations¶
icloudpd refuses to start and exits with code 2 when one configuration combines:
--auto-deleteand--keep-icloud-recent-days--auto-deleteand--delete-after-download--keep-icloud-recent-daysand--delete-after-download--prune-orphansand--delete-after-download,--keep-icloud-recent-daysor--only-print-filenames, or--prune-orphanswithout--library--ignore-indexing-stateand--auto-delete,--delete-after-download,--keep-icloud-recent-daysor--prune-orphans--watch-with-intervaland--only-print-filenames,--list-albums,--list-librariesor--auth-only
Previewing and watching¶
--dry-runsigns in and compares iCloud with local storage, but downloads and deletes nothing; it logs what it would do, deletions included.--only-print-filenamesonly prints the paths of files that would be downloaded. It deletes nothing and doesn’t run Sync either.--watch-with-intervalrepeats the run every X seconds, including the deletions of the selected mode.