Backup Scrivener Files with Automator

scrivener_icon.pngWouldn’t it be great if you could somehow automatically take a snapshot of your Scrivener novel's content and automate daily or weekly back-ups from your Mac to another location? Using Automator, it’s actually really easy.

Preparation

The following example assumes you have Panic's Transmit ftp software, which integrates well with Automator, to do backups to an FTP server. You can actually use Automator to backup files anywhere you want though -- another directory, your iDisk, you name it.

Open Automator

Launch Automator (find it in your Applications folder), scroll down the left column (Library) to find and select Transmit, grab the “Synchronize Files” action from the middle column (Actions) and drag it over to the workflow area on the right. Drag in other automator actions as appropriate. Following are some screenshots (click on the thumbnail to enlarge) to show you how I set up my backup workflow.

Here are the workflow steps you will need by the time you are done.

workflow.png

Add a 'Get Specified Finder Items' step. Here select your working Scrivener file. You can backup other files at this step as well.

scrivener_backup_1.png

Feed these files into a 'Create Archive' step. This will archive your files into a .zip folder.

scrivener_backup_2.png

You will want to have a separate copy of the backup each time you save. This gives you a version control system where you can always find versions of the file from days or weeks ago should you ever delete something and then not discover it till some time later! Add a 'Rename Finder Items' step and configure it to add the date to the filename.

scrivener_backup_3.png

Add another 'Rename Finder Items' step and configure it to add the time to the filename (this allows us to have multiple backups in one day).

scrivener_backup_4.png

Add the Transmit option to 'Upload Files' and configure it to the FTP server of your choice (or use Stronghold, cf. ...). Here you could instead copy the files to another disk attached to your Mac if you prefer.

scrivener_backup_5.png

Run a test to see if things work. You hit the play button near the top right corner of the Automator window, watch Transmit open up, connect to your FTP server, change to the correct directory, change the local path to the correct directory, then start uploading the Scrivener file. Once it’s done, it disconnects and closes Transmit. Perfect!

Running Backup On Demand
Save this Automater script to your Desktop (or wherever you like) choosing the “Application” file format, saving the file as BackupScrivener.app This creates a clickable application on your desktop that will launch the back-up whenever you like. You can also add this script as a plugin to your scripts menu so that you can backup right from your Mac's main menu.

Scheduling

Let’s say you want to schedule BackupScrivener.app to run automatically daily.

Open up iCal (yes, iCal!), and for the sake of clarity, create a new calendar (File > New Calendar) called “Scheduled Tasks”. Create a new event for this coming Friday "Scrivener Backup" with the following details:

  • scheduled for 11am
  • set to repeat daily (ending “Never”)
  • an alarm that opens BackupScrivener.app 0 minutes before the event

Here’s a screen shot of the event:

the iCal event settings

Every Friday at 11am (a time my computer is usually on, and I’m probably looking for a second cup of coffee) iCal will trigger the backup, backing up my novel to the server from my local disk.

Other Features

  • This will work if iCal or Transmit are already open or closed, which is nice.
  • You can drag in multiple File actions to one Automator workflow, so you can bundle all your weekly back-ups of different folders into one script and one iCal event, then make another one for daily or monthly tasks.
  • It’s an Automator workflow, so you can do all kinds of stuff – ask for a confirmation before running, tell it to send you an email afterwards, run an AppleScript, open your Strongspace account in Safari, etc etc.

Thanks to Stronghold

I’m not sure I would have ever thought of combining Transmit, Automator and iCal like this – the credit goes to the Strongspace blog. Check out their article on backing up files to Strongspace if you don't have an FTP server.

6 Comments

  1. After experiencing problems with the autobackup feature of similar program Avenir (which also does not have a recycle bin!), I am switching to Srivener and using this script, which seems really really useful. The problem with the Avenir autosave is that it overwrites previous autosaves, which is essentially useless as a backup. And if you accidentally delete a scene or a chapter in Avenir, you are screwed. Thanks for this wonderful script and the clear instructions.

  2. After experiencing problems with the autobackup feature of similar program Avenir (which also does not have a recycle bin!), I am switching to Srivener and using this script, which seems really really useful. The problem with the Avenir autosave is that it overwrites previous autosaves, which is essentially useless as a backup. And if you accidentally delete a scene or a chapter in Avenir, you are screwed. Thanks for this wonderful script and the clear instructions.

  3. I’m just starting to use Automator/Transmit to backup desktop files to a remote server. Wondering if you can help me with a problem I’m having.

    There are certain files that Transmit uploads even though they were just uploaded the night before. The transcript says “No such file or directory” but the exact same files, with the same names are already on the server. This only happens with certain files.

    I’m running the “Synchronize Files” script and have specified “upload” and “update.”

    Any help would be much appreciated.

  4. I’m just starting to use Automator/Transmit to backup desktop files to a remote server. Wondering if you can help me with a problem I’m having.

    There are certain files that Transmit uploads even though they were just uploaded the night before. The transcript says “No such file or directory” but the exact same files, with the same names are already on the server. This only happens with certain files.

    I’m running the “Synchronize Files” script and have specified “upload” and “update.”

    Any help would be much appreciated.

  5. Stan Shinn

    August 28, 2008 at 8:43 am

    I’m stumped on that issue — sorry, I can’t think of any good suggestions on how to debug that!

  6. Stan Shinn

    August 28, 2008 at 8:43 am

    I’m stumped on that issue — sorry, I can’t think of any good suggestions on how to debug that!