Mirror Mirror Macro -- A Backup Utility for World Backup Day

Mirror Mirror Macro

Latest Version: Mirror Mirror 1.5b in Post 3

To celebrate World Backup Day (today), this macro uses the built-in backup utility rsync to mirror any directory or single file in a Target location. Changes made to the Source will be reflected in the Target location, effectively making an archive of the Source.

ss-870.500x406

After the initial backup, which takes as long as any copy, only the changes are executed, which is much faster than a fresh copy. New files are copied, deleted files are deleted.

A log shows what was done and how long it took.

You can save and delete commands. You can also restore a Target to its Source from any saved command.

By handling the directory and file selection quoting and the rsync command itself, Mirror Mirror protects you from dangerous and frustrating syntax errors. I've used the rsync commands it uses in other macros for years but wanted a more flexible macro (and this one is replacing all those other ones pretty quickly, too).

For the wary (and it won't hurt to be wary, especially about Restore operations), the documentation includes a step-by-step Test Drive to demonstrate on dummy files what happens with each command.

Update (2 April 2021): Just a minor update to recognize the Return key for OK in all windows and Control-Option-H for Help and Control-Option-C for Cancel in the main window.

Update (6 April 2021): No longer recognizes Control-Option-H for Help and Control-Option-C for Cancel in the main window because the key chords may conflict with other macros. Instead, the main window now has a keyboard shortcut for each button (indicated by an orange underline). Also cleaned up the code that recognizes the Return key for OK.

Update (3 May 2021): Backups that travel over the network are, of course, noticeably slower than those that don't. So in v1.3a I've added an indeterminate progress bar to the three folder copying operations that might take longer. Inspired by Dan Thomas's Progress Bar v1.1, it's a simple Custom HTML Prompt running asynchronously with a Window ID that can subsequently be closed by another action after the rsync has completed. Rsync itself doesn't know where it is in its process, so an indeterminate progress bar at least lets you know it's running. (No change was made to the documentation.)

9 Likes

Mirror Mirror: 2022 Update

This is a small addition to Mirror Mirror that adds a Time Machine icon to the bottom of the prompt to launch a backup and display the System Preferences pane for Time Machine so you can monitor progress.

ss-565

I didn't want to concoct a separate macro (and trigger) for this backup option so I folded it into Mirror Mirror, which has become one of my most frequently used macros (perhaps a dozen times a day).

It also came in very handy when I was writing a macro to backup new folders of images and could not quite fathom the syntax for rsync to a new network drive. Mirror Mirror to the rescue. I just pointed to the source and target and copied the resulting rsync command shown on the report.

Here's the new version with new documentation:

Mirror Mirror.kmmacros (53.4 KB)

Mirror Mirror.pdf.zip (1.0 MB)

3 Likes

Mirror Mirror: 2023 Update

Another small change to Mirror Mirror that resolves a minor annoyance of the progress window not closing once in a while. I consolidated the various close window actions into one instance and preceded it with a short pause to avoid the issue.

ss-636

There's also a minor visual enhancement to the Time Machine button.

And just to round things out, there's a bonus macro to automatically run a Time Machine backup once a day (rather than manually on demand using the Mirror Mirror button). I run this in the middle of the night when I have better things to do so every morning I start the day with a backed up system.

Here's the new version with new documentation:

Mirror Mirror.kmmacros (53.7 KB)

Nightly MBP TM Backup.kmmacros (3.7 KB)

Mirror Mirror.pdf.zip (1.4 MB)

Update (28 May 2023): In version 1.5b, I revised the Report window to include a Cancel button to skip returning to the main window. Both Cancel and OK can get activated by the initial and OK still responds to Enter. Just one less step. [28 May update fixes a missing curly bracket in the HTML CSS that might affect display of the buttons in the Report.]

Mirror Mirror.15b.kmmacros (53.9 KB)

4 Likes