Shortcuts.app as UI to Rsync

ivan8881 pts0 comments

Shortcuts.app as UI to rsync

Shortcuts.app as UI to rsync

macOS Shortcuts turns out to be a great rsync launcher.

An example is my digital camera. When I plug in the SD card, I<br>typically have one objective: copy the new photos onto my hard<br>drive, and eject when finished.

The options I'm using here:

-u, --update<br>Skip existing files on the destination that have a modification time newer than the source file.<br>iCloud does something weird with modification times (and sometimes I<br>do things like rotate the orientation), so the -u skips<br>comparisons when destination files have newer timestamps.

-r, --recursive<br>If source designates a directory, synchronise the directory and the entire subtree connected at that point. If source ends with a slash, only the subtree is<br>synchronised, not the source directory itself. If source is a file, this has no effect.<br>Recursively copy the directory of photos.

Selecting the 'Eject' action target must be done when the drive to be<br>ejected is still mounted.

The steps are executed synchronously in order, so the rsync command<br>will be finished before the Eject action runs.

After saving, a launcher for the shortcut can be added to the dock by<br>right clicking it:

The shortcut even has useful error messages when execution fails<br>during shell commands:

This is the output when launched without the SD card mounted.

When running, a menu-bar icon shows a loading state:

When complete, the icon shows a check mark:

After which point, I can safely physically remove the SD card.

rsync source shortcuts directory card eject

Related Articles