Automatic Incremental Backup – an Apple Shortcut …

Bear Versoning Export – Apple Shortcuts

2023-04-01 at 17:34 IST

Have been testing and playing with the newly updated Bear Actions in Apple Shortcuts.

I’m very impressed and pleased withe the Export Note action:

  • It can export in all the formats supported by Bear 2.0
  • When saving the file from Shortcut, it sets modified and created dates from note onto exported file.

So I’m exited to share a couple of sample shortcuts below.
Use them as they are, modify, improve, mess them up, or trash as you please :smiley:

Table of Contents

  • Bear Export Versoning - Shortcut
  • Automatic sync of iCloud folder to Dropbox & OneDrive with Automator script on Mac
  • Bear Dropbox Export – Shortcut

Bear Export Versoning - Shortcut

Incremental Export/Backup of Bear Notes


  • Saves directly to local iCloud Drive folder
  • Incremental – only exporting notes updated since last run
    (compares with last run date-stamp, saved in *bear-export-settings.json file).
  • Search: @last7days -@locked to exlude password protected notes.
  • After full backup/export, use this daily (or how often necessary) for incremental backup/versioning.
  • Tips: Panda is great for previews, to check/compare verisons, before single note restore.
  • Exports into new nested daily folders: (yyyy-MM/yyyy-MM-dd)
    • iCloud: Shortcuts/bear-export/Year-Month/Y-M-Day/{Title} - {creation date}-{version#)
    • Makes it esay to find and also to clean up after new full backups – or whenever.
    • Or edit this Shortcut to make export flat, or whatever suits you better :slight_smile:
  • Notes with images or attachments will save as .bear files (zipped .textbundles)
    • get renamed to .textpack here, for better compability with Panda, Marked, etc.),
  • Notes without images/attachments, are exported as .md files.
  • Notes will export with new version# for each run if already in today’s folder.
    (Note! this does not work with .textbundles – they get treated as folders and messed up)
  • All files get Created Date trailing: “file-name - yyyy-MM-dd_HHmm.ext
    • to ensure uninque filenames for notes with same titles:
    • for easy info when export to cloud services, where created time stamp is lost,
    • and if you delete a note and make a new one with same title, you’ll have them both!
  • Tips: Schedule this (in the Shortcuts app) to run automatically on iPhone once (or a couple of times) a day.

Automatic sync of iCloud folder to Dropbox & OneDrive with Automator script on Mac

Download from Dropbox: Automator: Bear Export Versoning to Dropbox.workflow

  • Automator Folder Action, triggered by Bear Export Versoning Shortcut above
  • Uses rsync script to copy from local iCloud folder to local Dropbox & OneDrive folders
  • Works very well when the above shortcut is run on Mac.
  • Can be a delay when Bear Export Versoning Shortcut is run on iOS/iPad.
  • Will not sync from iOS/iPad if Mac is not online.
  • Supports .textbundle to Dropbox (current version for Mac)

Bear Dropbox Export – Shortcut

Experimental and Similar to Bear Export Versioning above.

  • Exports directly to Dropbox.
  • in a single folder and no versioning.
  • Good for use on mobile for direct sync to Web, Windows or Android.
  • Doesn’t work offline!
  • Can be slow to run on slow networks.
  • Dropbox-action doesn’t support .textbundle!
  • no logging of export runs to log-file.
  • No settings-shortcut, but the one above can easily be modified :sunglasses:

#bear/shortcuts @trix180


I tested this and it works great - thanks for sharing.

I was just curious. Would you mind explaining the goal of the regular expression processing that you are using to “clean” the titles.

Yes, it’s to remove characters that’s illegal in Windows file names and could cause trouble with Dropbox and OneDrive sync (that’s also triggered on my MacBook), including file names beginning with - or space, and finally adding “(Untitled)” if note doesn’t have a title.

It also removes any Markdown tagging (that’s now a new feature in B2 titles)

It maybe unnecessary if only on iCloud, and the get title action in Shorcuts may already strip off some of those characters, I just tried to be on the safe side, after a couple of test files were rejected by OneDrive sync.


So, if I update a note on a new day, will there be two versions of the notes in the backups, one from the first day & one from the second? (Same creation date but different version numbers)

Yes there will be a new version of the file every day that you run the shortcut and also have changed the note. But it will be in a new sub folder for every day, but only if there was note updates and if shortcut was run that day.

  1. /Shortcuts/bear-export/2023-04/2023-04-05/My Bear Note - {created date}.md
  2. /Shortcuts/bear-export/2023-04/2023-04-06/My Bear Note - {created date}.md

But if you update the note and run the shortcut, let’s say 3 times during same day,
the versions will be in the same day’s folder, but get a version number at the end:

  1. /Shortcuts/bear-export/2023-04/2023-04-06/My Bear Note - {created date}.md
  2. /Shortcuts/bear-export/2023-04/2023-04-06/My Bear Note - {created date}
  3. /Shortcuts/bear-export/2023-04/2023-04-06/My Bear Note - {created date}

Or: “My Bear Note - {created date}.textpack” if Note contains images or attachments.

The Bear note {created date} is added to file name to make unique filenames when notes have same title, and to differentiate between an old note that may have been deleted and Note Title was reused. I believe this is an important feature with this export, if one want to find and restore (import) an old version of the same note months later. Specially if one have changed the title in the meantime.

Note ID could have been used instead, but it’s too long an ugly. Also on export to Dropbox, OneDrive, etc, created date stamp on files get lost…

I have a big problem with the standard versioning on iCloud.
I changed recently a lot of notes (round about 50).
After that I got an error with your shortcut.

So I decided to delete all my versioning on iCloud and was hoping that it will recreate everything from scratch. Seems like I was wrong, it’s not backing up anything anymore.