Can KM Sync be used to quickly backup my macros on a daily basis ? (I am not referring to sync between 2 Macs)

My question does not refer to someone wanting to use syncing with 2 or more macs.

Let's assume we have one stand alone Mac running KM.
I am constantly editing my macros and would like to regularly (for example daily) backup my macros.
I am currently using @DanThomas 's excellent Macro Repository. The only problem is that the resulting folders are not compressed, and Dropbox is overloaded by the number of files accumulated.
I could backup the application support and preferences files but they are not located in the most user friendly areas.
I could also clone my primary drive every day.

In a moment of poetic genius, I was wondering if I could do this daily:
KM → Pref → Sync → Create New → add Date Time Stamp to standard Sync Filename → Save to Dropbox KM Sync Folder → wait 5 minutes for all macros to sync → turn OFF Sync. The resulting files are quite small (160 MB)
Question is how in case of trouble, I could recover the info, and if I did recover the info after a crash, what would be missing ?. In terms of recovery procedure, would I first have to delete all current KM Macros before the sync ?

thank you

2 Likes

KM's built-in syncing works with 1 Mac. My files are synced to Dropbox everyday and there is not much storage being used. Doing this, I don't believe you keep a history of changes, but you are backed up for when that crash happens.

2 Likes

thank you. I assume that you mean there is nothing like "previous versions" to choose from.

Assuming the following situation.

  • you have 500 + macros

  • you plan a major reorganization and preemptively sync the current macros. The sync file is a one time thing (sync on → create → add date time stamp to file → wait 5 min → sync off

  • is 5 min enough to populate the sync file ? more like 20 mn or less like 1 mn ?

  • you proceed with your major reorganization and realize you deleted 50 macros and wrongly edited another 50. You would like to revert to the pre organization status. What would be your procedure ?

Always assuming only 1 Mac.

thanks very much

Dropbox already keeps previous versions of files so you should be able to simply choose an earlier Keyboard Maestro Macros.kmsync file. No need to toggle syncing off/on and no need to do any renaming. Once Dropbox has reverted to that version, that is the version Keyboard Maestro will use.

But this is an all or nothing approach. Having said that, this has saved me a few times.

As you can see below, Dropbox has kept a new version for every single edit change and put the time of that change. The versions are created pretty much instantly as soon as you edit something in Keyboard Maestro.

And... as well as simply restoring to a previous version you can also download it giving lots of control.

image

And... in case you are wondering, these versions of files do not count towards your Dropbox Storage space.

4 Likes

A brilliant explanation. I will adopt your method. It's perhaps something that @peternlewis could add to the WiKi. It's so simple and efficient. Has none of the drawbacks I describe in my initial post. Thanks VERY much !

2 Likes

Don't forget that this isn't the primary purpose of the sync file (which is to to keep your Macros in sync across multiple computers). And also the versions are a function of Dropbox and this functionality is outside of Keyboard Maestro's control. Keyboard Maestro can also sync via iCloud and iCloud doesn't have versions. So, it is probably not something to include in the Wiki. Just a good thing to know about.

2 Likes

Yes, you are totally right. Thank you very much.

Hello again,

Just to make sure - a restore from a sync file recreates the macros and the macro groups, distributed as they were originally ?

Thank you

If you replace the current version of the .kmsync file with an older version of the .kmsync file yes, everything is restored to what it was at that point. Macros and Groups.

2 Likes

Great. Thanks very much.

Hey @ronald,

@Zabobon has solved this problem quite neatly for you, but I just wanted to add for posterity that it would be fairly easy to add a compression step to @DanThomas Macro Repository macro.

-ccs

1 Like

You have an excellent point, because the @DanThomas method has distinct advantages, namely to restore those few macros that the user bungled.
Obviously adding a compression step to the @DanThomas method would be ideal, but it is obviously not within my competence. How would I go about doing this. I don't think that @DanThomas is interested in revising that macro based on previous requests to do so (which I understand perfectly).

Looking at it from another perspective, I have a main "KM Dan Thomas Repository of macros" containing sub folders, each of which corresponds to a backup. I have to find some way to compress the main folder because it now contains 380,000 files which overloads Dropbox.

Is there any way to solve the problem by creating a macro which I would run each time (after) I run the @DanThomas repository macro and which would
1- select a folder → within that folder
2- take each subfolder → compress (and move in ie no more files left after the zip) ie create a zip for each subfolder

@Zabobon @ccstone

to answer my own question, using this hazel rule allows me to systematically zip all folders created by the @DanThomas method which allows me to cherry pick any macro(s) to restore

3 Likes