Jump to content
GreyGray

Backup Evernote whenever you want, no setup needed

Recommended Posts

I made an AppleScript that will export all your EN records to an enex file.

They are store in your Library/Application Support/Evernote-Backups folder

If that folder above does not exist, it will be made for you.

 

There are no code changes you need to make, just run the script, and you will end up with a time and date stamped backup.  run it once a day, once a week, as you see fit.  I was trying to do this all in a shell script with HEREDOCs but it was not working or proving too time consuming.  Had I been able to, I could have scheduled this to run once a day.  Right now, Applescripts can be scheduled, but they are foreground apps and would pop open and get in your way.

 

http://pastebin.com/PvqP4tkj

 

Copy that code, paste it into Script Editor, save as an application with no windows or dialog boxes, hook it to Keyboard Maestro or some other Macro app and fire at will.  Or just put the app in your dock and click on it once a day.

  • Like 1

Share this post


Link to post

@GreyGray:

 

Thanks for sharing your script.

 

It appears that you export ALL Notes to one ENEX file.  While this is convenient, it does not include the Notebook for each Note.

Generally it is recommended that only one NB be exported to each ENEX file, and that the ENEX file name include the NB name for ease of reference and import.

 

I also noticed that you select all Notes created since 1990.  This will a problem for users (like me) who have changed the Note Created Date to be earlier than 1990 (these Notes will NOT be included in the export).

I have a number of Notes of family records that predate 1990.

 

Just to remind everyone, ENEX files have these limitations:

  1. All Note Links to any of the Notes in the ENEX are broken, lost, and will have to be recreated.
  2. The ENEX files do not contain any Notebook data.
  3. To preserve Tags in the ENEX files, you must check the checkbox to include Tags during both the export and import process
  4. Tag hierarchy is not preserved.  If you had one, it will need to be recreated after the import process
  5. If the ENEX files came from Sync'd Notebooks,
    1. the Sync'd NB will have to be recreated, and the import of the ENEX Notes moved into the appropriate NB.
    2. Moving these Notes into Sync'd NBs will go against your monthly upload allowance

Share this post


Link to post

 

@GreyGray:

 

Thanks for sharing your script.

 

It appears that you export ALL Notes to one ENEX file.  While this is convenient, it does not include the Notebook for each Note.

Generally it is recommended that only one NB be exported to each ENEX file, and that the ENEX file name include the NB name for ease of reference and import.

 

I also noticed that you select all Notes created since 1990.  This will a problem for users (like me) who have changed the Note Created Date to be earlier than 1990 (these Notes will NOT be included in the export).

I have a number of Notes of family records that predate 1990.

 

Just to remind everyone, ENEX files have these limitations:

  1. All Note Links to any of the Notes in the ENEX are broken, lost, and will have to be recreated.
  2. The ENEX files do not contain any Notebook data.
  3. To preserve Tags in the ENEX files, you must check the checkbox to include Tags during both the export and import process
  4. Tag hierarchy is not preserved.  If you had one, it will need to be recreated after the import process
  5. If the ENEX files came from Sync'd Notebooks,
    1. the Sync'd NB will have to be recreated, and the import of the ENEX Notes moved into the appropriate NB.
    2. Moving these Notes into Sync'd NBs will go against your monthly upload allowance

 

 

Wow, I was unaware of those limitations.  On the EN site somewhere, it even says something along the lines of "we don't lock you in, you can export your data in a format that is standard and usable and re-importable", not those exact words, but that was the impression I got.

 

Now, at best, this backup script can be looked at as a last resort backup set, one that will import back in, but you are going to have a ton of work to do to get it how you had it.

 

It could be worked around, in that instead of a export of the entire thing, iterate through each notebook to get the notebook name, perform a find to find just the items in the notebook, loop through each notebook, as you do so, grab the tags and store those in a file that is connected to the export via some ID matching system you have made up.  If you have 20 notebooks, you are getting 20 files exported, and with each export of each notebook, there would be a file of 43432423.tags that had the tags for the note itself.

 

Next, I would have to write an importer, as you can't use the one in EN.  Two options, build an importer, or import via EN and write a script that puts everything back how it was by reading the files off your disk and reading the .tags files.  Easiest would be to make certain when exporting that the "save tags in note" checkbox thing is selected.  I'm not sure if that is selected in my export.  I will have to look at one of them and see.

 

Creating exports for each notebook would not be a hard mod to this script.  But you are still going to lose your stacks and lose your internal links.  To me, that means this is not a backup, but an export that can sort of be used as a backup.  Because of this, I don't think I will work on exporting.  Instead, it would probably be best to learn the internal workings of EN as to it's local file structure, copy the local files on disk into an archive using tar, but tell tar that it needs to put back to the correct location the items it backed up.  The only requirements to getting this working is that EN is not running or being used.

 

The only trouble is that the layout of files is so different on various systems, even if this is just kept to the Mac only.  There is stuff all over the place.

  • Like 1

Share this post


Link to post

 

@GreyGray:

 

Thanks for sharing your script.

 

It appears that you export ALL Notes to one ENEX file.  While this is convenient, it does not include the Notebook for each Note.

Generally it is recommended that only one NB be exported to each ENEX file, and that the ENEX file name include the NB name for ease of reference and import.

 

I also noticed that you select all Notes created since 1990.  This will a problem for users (like me) who have changed the Note Created Date to be earlier than 1990 (these Notes will NOT be included in the export).

I have a number of Notes of family records that predate 1990.

 

Just to remind everyone, ENEX files have these limitations:

  1. All Note Links to any of the Notes in the ENEX are broken, lost, and will have to be recreated.
  2. The ENEX files do not contain any Notebook data.
  3. To preserve Tags in the ENEX files, you must check the checkbox to include Tags during both the export and import process
  4. Tag hierarchy is not preserved.  If you had one, it will need to be recreated after the import process
  5. If the ENEX files came from Sync'd Notebooks,
    1. the Sync'd NB will have to be recreated, and the import of the ENEX Notes moved into the appropriate NB.
    2. Moving these Notes into Sync'd NBs will go against your monthly upload allowance

 

 

Just as an FYI, from the Applescript dictionary for the "export" verb:

exportv : Export notes.

export list of note : the notes to export.

to file : File to export into. The contents of this file will be overwritten.

[tags boolean] : Include tags when exporting. Default is TRUE.

[format ENEX/‌HTML] : Format for note export. Default is ENEX.

 

 

Tags and the ENEX format being enabled are the default settings unless specified otherwise.  Since I only do this:

export matches to f

Then the defaults should stick, though I could change it to export tags TRUE format ENEX to filename,.ENEX

 

If I were iterating the notebooks I would use notebookname.enex as the filename, but losing tags and internal links is a bummer.  I just made my first internal note to note link, and am going to go remote it, and merge the two notes together as this is not a feature i want to use, as it comes with lock-in of your data,

  • Like 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...