BART

a full-featured Backup, Archive, and Restore Tool


Description


iOS 14 Note: This version of BART has not been tested with iOS 14, but based on what I've read, it will likely work with simple or no modifications. With that said, the Restore features of BART could likely be simplified because with iOS 14 it appears that *.shortcut files can be directly imported into the Shortcuts app (i.e., imports are not restricted to iCloud versions). The very good news is that with all versions of BART, shortcuts are saved to your iCloud Drive, thus all previous backups, archives, etc. should carry forward.

I will be downloading iOS 14 soon and, if my information is correct, I'll: 1) first test this version of BART, and then 2) create a new version with a streamlined restore process for iOS 14 users. (Now for some inside baseball: Interestingly, many, many months ago, I created a similar backup/restore tool using the Workflows app, the predecessor of the Shortcuts app. That tool used a simple restore process that I'll likely be able to use with BART. It's a good thing I backed it up! 😉 )


Overview

BART is a shortcut that can back up, archive, and restore shortcuts in the Shortcuts app Library, also known as My Shortcuts. It is designed to be full-featured, yet simple and fast to use. In fact, most of the information below can be easily discovered by simply running the shortcut*. However if you prefer to read instructions and/or learn some of the finer points of BART, the following is for you.

* There are a few significant exceptions. For example, running BART from another shortcut, a very powerful yet easy to use feature, is not discoverable (unless you peer into the actions of the BART 😀 ). Therefore, even if you have used the interactive features of BART, you'll find some very useful information beginning with the section Running BART From Another Shortcut.

A video overview of BART is available here. Changes for Version 2.0 are highlighted in this video.


So what's the point?

Short answer: It's always good to back up your work!

Long answer: Stuff happens! On occasion, the iOS Shortcuts app will display an error indicating that the database is corrupt. If iCloud Sync (one of the Shortcuts app settings) is set, the Shortcuts app attempts to recreate My Shortcuts after the error dialog is dismissed. Depending on the circumstances, this restoration can range from a complete recovery to a complete loss of all of the shortcuts in My Shortcuts. If not a complete recovery, shortcut backups are indispensable. Backups are also valuable during more common and frequent events, e.g., if a shortcut is mistakenly modified or deleted.

In addition to shortcut protection, backups can be employed to manage shortcuts. For example, a user might find a group of shortcuts that are useful occasionally, but not want to clutter My Shortcuts with these rarely used shortcuts. Such shortcuts could be archived and restored when needed.


BART Main Menu

This section includes a short description for each Shortcut Operation on the BART main menu.

Save Snapshot of My Shortcuts saves a copy of all shortcuts in My Shortcuts to the snapshot folder: /iCloud Drive/Shortcuts/BART/Snapshot/. All files previously in this folder are deleted before the shortcuts are copied to this folder. This is the fastest and simplest way to back up My Shortcuts.

Back Up Selected saves copy of one or more selected shortcuts in My Shortcuts to the backup folder: /iCloud Drive/Shortcuts/BART/Backup/. Shortcuts files in the folder are written over if the selection includes shortcuts with the same names.

Shortcuts previously backed up to the backup folder and later deleted from My Shortcuts are not automatically deleted from the backup folder. Thus over time, the backup folder will likely contain a superset of shortcuts from My Shortcuts.

Archive All creates a zip archive of the shortcuts in My Shortcuts and saves the file to the archive folder: /iCloud Drive/Shortcuts/BART/Archive/. The archive is named based on the date/time and #x (where x is the number of shortcuts in the new zip archive). For example, the following archive would include 102 shortcuts: 2019-12-10-073522_#102.zip.

Archive Selected creates a zip archive of one or more selected shortcuts in My Shortcuts and saves the file to the archive folder: /iCloud Drive/Shortcuts/BART/Archive/. The archive is named based on the date/time and either: a) #x (where x is a number 2 to n indicating the number of contained shortcuts), or b) shortcutname (if only one shortcut is selected). For example, the following archive would include 102 shortcuts: 2019-12-10-073522_#102.zip and the following would include one shortcut named xyz: 2019-12-10-073522_xyz.zip.

Restore (from a selected folder) displays a list of specified folders that contain shortcut files. Once the user selects one of the folders, a second selection list is displayed with all of the shortcuts within the folder. If the user selects one or more of these shortcuts, they are restored to My Shortcuts.

By default, the folder list contains three folders in /iCloud Drive/Shortcuts/:

  • BART/Snapshot/
  • BART/Backup/
  • BART/Develop/

Any other folder in /iCloud Drive/Shortcuts/ can be added to the list by adding it to a List action within BART. This could be useful for users that have used another means to backup and/or organize shortcut backup files. Note: All folder entries are case-sensitive!

Restore (from a zip archive) displays a list of zip archives in the archive folder: /iCloud Drive/Shortcuts/BART/Archive/. If a user selects one of the zip archives, the file is unzipped into a new subfolder in the unarchive folder: /iCloud Drive/Shortcuts/BART/Unarchive/. For example, if the user selected 2019-12-10-073522_#102.zip the archive would be unzipped into the following: /iCloud Drive/Shortcuts/BART/Unarchive/2019-12-10-073522_#102/. After the archive is unzipped, a second selection list is displayed with all of the shortcuts within the subfolder. If the user selects one or more shortcuts, they are restored to My Shortcuts.

Restore (from an unarchive folder) displays a list of subfolders in the unarchive folder. If a user selects one of the subfolders, a second selection list is displayed with all of the shortcuts within the subfolder. If the user selects one or more shortcuts, they are restored to My Shortcuts.

This restoration operation would be used to recover a shortcut that was previously archived (using Archive All or Archive Selected) and then subsequently unzipped using the Restore (from a zip archive) operation.

Restore One (from a file browse) will open a file selection dialog to allow the user to select a shortcut file. The selected shortcut will be restored to My Shortcuts.

This restoration operation would likely be used infrequently as it is intended for files that were backed up prior to using BART. This method has the advantage of being more flexible in that the shortcut file can be located anywhere, not limited to /iCloud Drive/Shortcuts/. The disadvantage of this method is that only one shortcut can be selected per file browse.

Help displays this information.


Segregating Saved Files by iOS Device

By default, all files created by BART are saved exactly as described in the above sections. This is appropriate if:

  • only one iOS device is being used, or
  • if multiple devices are being used and iCloud Sync is ON for all devices (that use BART).

Conversely in cases where multiple iOS devices are being used and iCloud Sync is not being used, it is recommended to segregate the BART files. This change can be made when BART is first downloaded or at anytime later using Settings -> Customize Shortcut.

If segregation is selected, the BART root folder becomes: /iCloud Drive/Shortcuts/BART/device_name. For example, if the device name is My iPhone, the folders mentioned in the previous section would be subfolders of /iCloud Drive/Shortcuts/:

  • BART/My iPhone/Snapshot/
  • BART/My iPhone/Backup/
  • BART/My iPhone/Archive/
  • BART/My iPhone/Unarchive/
  • BART/My iPhone/Develop/

Shortcut and Workflow Files

Shortcut files saved to iCloud Drive by BART include a shortcut extension (e.g., xyz.shortcut).

The Shortcuts app is an updated version of Workflow, a third-party iOS app that Apple acquired in 2017. Although similar, this app included workflows, not shortcuts. Workflow files included a wflow extension and, like shortcut files, can be restored using BART.


Restoring Shortcuts

With iOS 13.x, the Shortcuts app cannot restore/import a shortcut file directly from iCloud Drive. (This limitation did not exist with the iOS Workflow app, but may have been added by Apple for security reasons.) Therefore to restore/import a shortcut, the shortcut file must first be uploaded to iCloud (in a public area established by Apple that is reserved for shortcuts). Once uploaded, a shortcut file can then be restored/imported within Safari by opening an iCloud link (to the uploaded shortcut file).

BART automates the process described above. However once the link is opened in Safari, a user must complete the final step by selecting blue Get Shortcut button that appears on the shorcut's Safari page. Because of a limitation with the Shortcuts app, this final step cannot be completed if a shortcut is still running. Due to these constraints, only one shortcut can be automatically restored/imported for each run of BART (or any similar restoration shortcut). Therefore if the user selects more than one shortcut to restore, the first one will be restored during that run of BART; shortcuts 2 to n will be queued up and ready to be restored, one at a time, with each subsequent run of BART.


Optional Management of iCloud Folders

As mentioned above, snapshot, backup, and archive files are saved to /iCloud Drive/Shortcuts/ subfolders, specifically BART/Snapshot/, BART/Backup/, and BART/Archive/, respectively. In addition, BART/Develop/ houses copies of shortcuts that are modified using the Develop operation.

In general, the contents of these folders are managed automatically by BART, but in some cases the contents can be managed manually using the iOS Files app or the macOS Finder. Specifically:

  • Shortcuts no longer needed but previously backed up to BART/Backup/ can be manually deleted.

  • Shortcuts files (*.shortcut), and even old Workflow files (*.wflow), can be manually added to BART/Backup/. These shortcuts (or workflows) can be restored using the Restore (from a selected folder) operation.

  • As an alternative to the above bullet, old Shortcuts app (or Workflow app) backups could be managed in a separate folder(s) within /iCloud Drive/Shortcuts/. Files in this folder(s) can be restored using :

    1. Restore One (from a file browse).
    2. Restore (from a selected folder). In this case, the /iCloud Drive/Shortcuts/ subfolder(s) would need to be added to the folder list using the List action within the shortcut. This list appears near the top of BART and includes a preceding comment. Note: All folder entries are case-sensitive!
  • Unneeded zip archive files in BART/Archive/ can be deleted when they are no longer needed.

  • Unneeded copies of shortcuts in BART/Develop/ can be deleted when they are no longer needed; however, older copies will be automatically purged per the Copies value when using the _Develop operation. See Protection While Developing or Modifying Other Shortcuts__ for more information.)

  • Older zip archives that include shortcuts (or even workflows), that may have been created by some other means, can be manually added to BART/Archive/. BART could then be used to process these archives just as it does for the archives that it creates.

  • Unarchive subfolders in BART/Unarchive/ can be deleted (e.g., BART/Unarchive/2019-12-12-131131_#109). Also, shortcuts no longer needed can be individually deleted from these subfolders.

  • Note: Shortcuts files can be copied from BART/Snapshot/, but since this folder is automatically managed by BART, the folder contents should not be modified.


Running BART From Another Shortcut

BART can be optionally started from another shortcut. This is also known as running BART in Input mode. This mode is useful because routine tasks can be automated and run consistently and quickly without user interaction with the BART main menu.

Before continuing, download these simple, example shortcuts:

  1. Snapshpt ➤ BART
  2. Archive ALL ➤ BART
  3. Back Up ➤ BART
  4. Archive ➤ BART

Snapshpt ➤ BART and Archive ALL ➤ BART can be used as is. For the other two, Duplicate them to create a copy that can be modified for your use. For example, copy Archive ➤ BART and name it Archive (My Stuff) ➤ BART. Then open Archive (My Stuff) ➤ BART and continue reading.

To run BART in this mode, the calling shortcut needs two actions: Dictionary and Run Shortcut.

This Dictionary information is used by BART to determine the desired Operation (in lieu of user interaction with the BART main menu). Depending on the BART Operation, the Dictionary action must have one or two Dictionary Items: [item 1: Key = Operation] or [item 1: Key = Operation; item 2: Key = Shortcut].

The following one-item BART Operations are supported:

  • Dictionary[item 1: Key = Operation, Text = Snapshot]
  • Dictionary[item 1: Key = Operation, Text = Archive All]

And the following two-item BART Operations are also supported:

  • Dictionary[item 1: Key = Operation, Text = Back Up; item 2: Key = Shortcut, Text = shortcut_name]
  • Dictionary[item 1: Key = Operation, Text = Archive; item 2: Key = Shortcut, Text = shortcut_name]]

As mentioned above, the above Dictionary action must precede the Run Shortcut action (specifically Run[BART]).

Note 1: In the second group of BART Operations, a third key [Key = Shortcuts] can replace the second key [Key = Shortcut]. This must be employed when backing up or archiving more than one shortcut with a single Dictionary/Run[BART] pair. In this case, the Dictionary item must be an Array, with Key = Shortcuts, and the shortcut_names are entered as separate Text array items.

Note 2: If the Dictionary includes Shortcut (Text Key for 1 shortcut_name) and Shortcuts (Array Key for 1 or more shortcut_names), all shortcut names will be used by BART.


Shortcut Automation

The shortcuts mentioned in the previous section, Running BART From Another Shortcut, are great candidates for the Shortcuts app Automation, also known as personal automation in the Shortcuts User Guide. As an example in the two following videos, Archive ➤ BART is used to demonstrate how a full archive can be executed at 11:30/pm everyday.


Protection While Developing or Modifying Other Shortcuts

BART Input mode operations are discussed in a section above: Running BART From Another Shortcut. BART includes one additional operation: Develop. This operation, however, is unique in that it is not available when running BART interactively.

Develop is used to save a copy of a shortcut to the develop folder (/iCloud Drive/Shortcuts/BART/Develop/) and then open the shortcut in the Shortcut app editor. Then, if needed (e.g., if a large block of actions is mistakenly deleted during the editing session), the saved copy can be restored using BART interactively (using Restore from selected folder).

Before continuing, with the following shortcut, download, Duplicate, and open your copy:

Note that this is an example that specifies three shortcuts: Brush Teeth Timer, Log Water, Tea Timer, selected in the example simply because they are available in the Shortcuts app Gallery. In the Dictionary action:

  • item 1: Key = Operation, Text = Develop
  • item 2: Key = Shortcut, Text = Log Water
  • item 3: Key = Shortcuts (an Array), item 1: = Log Water
  • item 4: Key = Copies, Number = n
  • item 5: Key = Notify, Number = 0 or 1 (for No or Yes)

BART combines the single name in Shortcut key with the one or more names in Shortcuts key. After the keys are combined, if the list contains more than one shortcut name, BART will generate a Choose from List so that the shortcut of interest at that particular time can be selected. This is helpful if there is a set of shortcuts that are regularly opened in the Shortcuts app editor.

If only one shortcut name is specified, then BART will copy the shortcut and open it in the editor, i.e., the Choose from List will not appear.

PRO Tip: One can specify commonly edited shortcuts in the Shortcuts key. Then in a case where there will be many editing sessions with one shortcut, the Shortcut key could be used and the Shortcuts key could be renamed to xShortcuts. That way, the Choose from List would be bypassed during the focused work on the single shortcut.

The Copies key defines how many copies of a shortcut will be retained in the develop folder. If this key is not specified, the default value (defined in BART) will be used. Older copies in excess of this setting will be automatically deleted from the develop folder.

The Notify key determines if BART will generate a notification when the shortcut is copied. If this key is not specified, BART will use its Suppress Notifications? Configuration Parameter to determine if a notification should be generated.


Shortcut Testing

BART, has been tested with the following:

  • iOS 13.5.1
  • iPhone 8 Plus
  • iPad Pro 10.5"
  • Shortcuts app Libraries exceeding 1000 shortcuts

Shortcut Development and Acknowledgments

  • BART is available exclusively at RoutineHub.co. Versions obtained elsewhere might be out-of-date.

  • The framed screenshots were created using the shortcut Apple Frames (iOS) from the MacStories Shortcuts Archive.

  • The menus in this shortcut use Apple SF Symbols that were encoded using another shortcut SF Symbol for vCard Menu. That shortcut uses the Create Icon action included in the premium version of Toolbox Pro.

  • BART checks for updates of itself every 7 days using Embed-a-Update (Version: 1.1.2, Updated: 10/13/19).


Latest Release Notes

2.4 - July 17, 2020, 4:57 a.m.

REQUIRED UPDATE for iOS 14 Developer beta 2:

With that version of iOS, the 'Combine Text' action is broken. This shortcut includes a workaround*. For more information: https://bit.ly/3h5xdGf

*Note: Similar changes were made in v2.2. In this version, there were two menus corrected that were overlooked when v2.2 was created.


Past versions