Migrate Evernote to Obsidian

I’ve been using Evernote for 16-ish years.1 Admittedly less, over the years, and I’ve been switching to Obsidian, but Evernote still had its uses.

And then I received this notice:

Screenshot of Evernote price increase notification

o_O

Last year, when the price jumped from $29.99 to $43.99 it was bad enough, but a near triple increase in one year is a hard ‘no’ and I’m certainly not benefiting from Evernote enough to warrant this increased spend.

Batch Migration

If you, too, need to evacuate from the Evernote ecosystem, and cannot be bothered exporting a hundred or so notebooks by hand:

  1. evernote-backup will help you batch export your notebooks to .enex files. Follow the steps in README, but ultimately it’s these three commands:
evernote-backup init-db
evernote-backup sync
evernote-backup export output_dir/
  1. yarle will convert the .enex files to markdown that you can move into your Obsidian vault when you’ve confirmed it’s how you want it. The sample config in the README is a good starting point.

Important Note: You can add a directory to the enexSources array, but it appears to only use the first element. So you can add one .enex file, or one directory that contains .enex files. It will not recursively look for more notebooks so stacks are not supported.

I have written a quick and dirty bash script that finds all directories under your specified input directory and iteratively run the script and puts the files sort of in the right subdirectory. ‘Sort of’ because yarle also hardcodes output into output_dir/notes. So you will end up with:

output_dir/
├─ notes/ 
├─ sub_dir/
│  ├─ notes/

I tried to clean up the redundant notes/ directories but mv wasn’t doing the trick and it was taking me more time to figure out what was amiss than just doing a mv/rmdir after, so you’ll have to live with that or fix it yourself. The joys of open source.

#!/bin/bash
# Source: https://www.baeldung.com/linux/bash-expand-relative-path
resolve_relative_path() (
# If the path is a directory, we just need to 'cd' into it and print the new path.
if [ -d "$1" ]; then
cd "$1" || return 1
pwd
# If the path points to anything else, like a file or FIFO
elif [ -e "$1" ]; then
# Strip '/file' from '/dir/file'
# We only change the directory if the name doesn't match for the cases where
# we were passed something like 'file' without './'
if [ ! "${1%/*}" = "$1" ]; then
cd "${1%/*}" || return 1
fi
# Strip all leading slashes upto the filename
echo "$(pwd)/${1##*/}"
else
return 1 # Failure, neither file nor directory exists.
fi
)
while getopts i:o:c: option
do
case "$option" in
i) in="$OPTARG";;
o) out="$OPTARG";;
c) config="$OPTARG";;
esac
done
if [ ! -d "$out" ]; then
echo "Output directory '${out}' does not exist";
exit 1
fi
if [ ! -f "$config" ]; then
echo "Config file '${config}' does not exist";
exit 1
fi
abs_in=$(resolve_relative_path "$in")
while read -r d; do
echo "$d"
jq --arg src "$d" --arg out "${out%/}${d#$abs_in}" '.enexSources = [$src] | .outputDir = $out' "${config}" > "${config%.*}.tmp.${config##*.}"
npx -p yarle-evernote-to-md@latest yarle --configFile "${config%.*}.tmp.${config##*.}"
done < <(find "$abs_in" -type d)
view raw batch_yarle.sh hosted with ❤ by GitHub

Manual Migration

Obsidian has their own importer that supports .enex and you can find a guide to using it here, but it’s only one notebook at a time so I haven’t used it.


Footnotes

  1. My oldest notes are dated 2006, but it looks like my ‘active’ note-taking started in 2008 which corresponds with when Evernote first went into open beta. Perhaps I had imported notes from another source.

Published June 27, 2024