Skip to content

Instantly share code, notes, and snippets.

@lf-araujo
Last active March 30, 2019 18:47
Show Gist options
  • Save lf-araujo/4ceba71fc5ada14b0395f1b77979663c to your computer and use it in GitHub Desktop.
Save lf-araujo/4ceba71fc5ada14b0395f1b77979663c to your computer and use it in GitHub Desktop.
Keeping my Evernote Notes as Local Markdown Files

Keeping Evernote Notes as Local Markdown Files

There is a very efficient way of managing your Evernote annotations, which is using everpad in Linux. However, it is neither working in Ubuntu 14.04, nor in elementary OS. Here is an alternative approach to deal with your evernotes notes.

This approach allows you to keep a local version of your notes as markdown (.md) files. This makes your notes searchable by Recoll or Zeitgeist, as well as it keeps them ready for rendering odf, docx, pdf or html files using pandoc.

The following was tested on ElementaryOS, but it can be easily achieved in various others distributions. The tools needed for the task are: cron and geeknote.

WARNING

The instructions are only for text annotations, if you have any images in your synced Evernote collections, you will lose them. Also expect to lose part of the formatting of complex notes. Lastly, note that with this approach, no notes can be deleted; if you delete them online, they will be synced up from your pc. If you delete them locally, they will be synced down from Evernote.

Install geeknote

Geeknote is a command line program that helps you manage your evernote notes.

git clone git://github.com/VitaliyRodnenko/geeknote.git 
cd geeknote 
sudo python setup.py install

Now login to your evernote, by issuing the command:

geeknote login

After login you can sync your collections using the command gnsync. But you will probably want to automate it.

Automating synchronization

Open your preferred file editor, create a file named sync_all.sh and add the following:

#!/bin/bash sync_all.sh

function sync_notebook {

	gnsync --path ~/Evernote/$1 --logpath ~/.log/geeknote$1.log --format markdown --notebook "$1" --two-way

}

for D in *; do sync_notebook $D; echo "$D"; done

What this bash file does is it crawls into the path where you want your notes (~/Evernote), checks for directory names that matches your Notebook names in Evernote. For every matching directory it syncs its contents (markdown files) bidirectionally with Evernote.

Now the next step is to install this simple program. You can run sudo install /usr/local/bin sync_all.sh, which will install it in the proper directory in any Unix system. It will become executable from everywhere.

Configure your crontab

Open the crontab editor:

crontab -e

And, if you don't want the automatization through the previous bash script add a line for each notebook that you want to sync. For daily syncs it would look like:

@daily gnsync –p ~/Evernote/Ler –f markdown –n “.Ler” –t TWO_WAY

The command is pretty straightforward. First you tell the path to the files, then you state that it will be dealing with .md files, the name of the notebook and finally that it should carry out a two-way sync.

You have to enter a new line on your crontab for each notebook that you want synced. Don’t forget that these should not have images, otherwise you will lose them.

Now the preferred alternative, which will do it all automatically using the previous sync_all.sh bash script. Open crontab as stated with crontab -e and add

0 23  * * * /usr/local/bin/sync_all.sh

This is a crontab entry set to call sync_all.sh daily at 23h, you can use @daily instead of 0 23 * * * and the system will pick a time to run the synchronization.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment