Skip to content

Instantly share code, notes, and snippets.

@yinchuan
Created June 11, 2022 10:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yinchuan/35f57c518d0671d557e767e634e9c417 to your computer and use it in GitHub Desktop.
Save yinchuan/35f57c518d0671d557e767e634e9c417 to your computer and use it in GitHub Desktop.
Restore a note of Evernote from Time Machine backup
  1. locate Evernote database file in Time Machine
    1. locate Evernote folder/Users//Library/Application\ Support/Evernote
    2. find database fileconduit-storage/https%3A%2F%2Fwww.evernote.com/UDB-User+RemoteGraph.sql
  2. copy the .sql file to some place, let say ~/Download
    1. do not work on the backed up file
    2. do not work on the current Evernote file
  3. find id of the note
    1. copy internal link of the note in Evernote: `evernote:///........///
    2. the second last part if the note id
  4. open terminal
    1. cd ~/Downloads
    2. sqlite3
    3. run query select TValue from Nodes_Note where TKey="", this will give metadata of the note
    4. looking for lookasideKey in result, looks like "Note::::content.content`
    5. retrieve note content, query select TValue from CacheLookaside where TKey="";, this gives the content of note which is in HTML

How do I find which is the database file?

du -s ./* | sort -n in Evernote folder

10520	./conduit-fs
14384	./Partitions
31088	./logs
190096	./conduit-storage
736112	./resource-cache

Tried resource-cache, got nothing. Found sql files in conduit-storage. Guess it's the largest one.


How do I find which table the note is stored?

There are quite a few tables there. It should be the one with the most number of rows. Copy the .sql file to somewhere, open it with sqlite, then

ANALYZE
select stat,tbl from sqlite_stat1;

Found two tables with lots of rows, after a few trial query:

  • CacheLookaside: where content of a note is stored
  • Nodes_Note: store: where meta data of note is stored, in JSON
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment