Going Paperless #107: How and Why I’ve Automated Backups of My Evernote Data
Originally published on August 12, 2014.
Short post today as I am in L.A. for work and insanely busy. I’m actually writing this post from the bar in my hotel and it is last night, after a roughly 15 hour day of work. So please forgive any brevity.
Once a month, export all of my Evernote data to an ENEX file, which sits on an external disk. That file, in turn, gets backup by my cloud backup service, CrashPlan. It may seem kind of silly to back up notes that are already stored in the cloud, but I have what I think is one really good reasons for backing up my data.
Why I backup my Evernote data
Backing up data–even data in the cloud that is generally readily accessible–acts as a kind of insurance policy. I am planning ahead for the unexpected. Being prepared for the unexpected is something that I picked up back in my flying days, when all kinds of little problems might crop up, and being able to decide whether or not they were serious was important.
In truth, what I am preparing for is my inevitable screw up. I know that at some point in time, I am bound to so something unintentionally destructive. Perhaps, after working hard many days, with little sleep, I accidentally drag an important notebook to the trash, and then purge the trash before I realized what happened. Once that happens, and Evernote syncs with the server, the notes are unrecoverable.
That might seem extreme, and perhaps it is. But I’ve worked with technology (and been a professional in the IT field) long enough to know that I am eventually bound to screw up. Having a backup of my notes provides some measure of protection against those screw-up, and that is the main reason that I back up my Evernote data.
How I backup my Evernote data
I work primarily on a Mac, and so I wrote an AppleScript to take advantage of Evernote’s AppleScript interface to automate the process of backing up my Evernote data.
You can find my AppleScript on GitHub.
The script is pretty simple. It selects all notes after January 1, 1990, and exports them to an ENEX file on a specified path. I chose that date because it will backup any notes after that date. If you’ve created notes and dated them prior to 1990, you’ll want to change line 10 of the script to reflect the appropriate date.
You’ll also want to update line 5 with the path on your machine that you want the export file to reside. In my code, I’ve export mine to an external drive that is backed up by my cloud backup service.
When I run the script, it selects all of the notes that meet the criteria and then exports them. I have more than 8,000 notes so this takes a little while. I set the timeout to 30 minutes, which is usually plenty of time for me. When the export is complete, the script then compresses the export file so that it is a little smaller when it is backed up to my cloud backup service.
Automating the process
As it stands, the script has to be run manually. To automate the process, I use an app called Lingon, which makes it easy to schedule jobs on the Mac. I have my script run once a month (usually on the first day). Once the job is setup in Lingon, the script runs automatically.
Restoring from the export
“In the unlikely event of a water landing,” as they say, optimistically before your flight… I’ve done some testing of restoring ENEX files into Evernote, and the process works very well. All of the notes are restored, including the tags. But the notes are all restored to a single “restore” notebook. This actually makes sense, because you might be restoring a small set of notes and don’t want to overwrite existing notes. I was able to import the ENEX file, see all of my notes, and then manually move them into the appropriate notebooks. A little cumbersome, yes, but if I’ve made a dumb mistake that requires me to restore notes from backups, I’m happy to do a little extra work.
What about Windows?
As I said, I primarily work on a Mac. It is possible to script exports on Windows, but it is from the command line using command line options of Evernote itself. Since I don’t use Windows as my primary Evernote repository, I haven’t investigated this. But I’m pretty sure it is possible.
ETA: See the first comment for a good example of how to automate your backups in Windows.
ETA 8/16: For folks who have been reporting an error with the script, see Scott’s comment below. Apparently, the error only occurs in version of Evernote downloaded from the App Store. If you download Evernote from Evernote.com, you won’t see any error. My guess is that the error from the App store version has something to do with sandboxing.
Originally published at www.jamierubin.net on August 12, 2014.