Advertisement
ebertek

Export notes from Notes.app on OS X

Jun 8th, 2015
1,179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 1.24 KB | None | 0 0
  1. -- 10.10 Yosemite: ~/Library/Containers/com.apple.Notes/Data/Library/Notes/NotesV4.storedata
  2. -- 10.11 El Capitan (Legacy): ~/Library/Containers/com.apple.Notes/Data/Library/Notes/NotesV5.storedata
  3. -- You should also save attachments from this folder: ~/Library/Containers/com.apple.Notes/Data/Library/CoreData/Attachments/
  4.  
  5. -- You should commit the changes in the -wol file:
  6. PRAGMA wal_checkpoint(RESTART); VACUUM;
  7.  
  8. SELECT a.ZDATECREATED, a.ZDATEEDITED, a.ZTITLE, b.ZHTMLSTRING
  9. FROM ZNOTE AS a
  10. LEFT JOIN ZNOTEBODY AS b ON a.ZBODY=b.Z_PK
  11. -- or ON a.Z_PK=b.ZNOTE
  12. ORDER BY a.ZDATEEDITED;
  13.  
  14.  
  15.  
  16. -- 10.11 El Capitan: ~/Library/Group\ Containers/group.com.apple.notes/NoteStore.sqlite
  17. SELECT a.ZCREATIONDATE, a.ZMODIFICATIONDATE1, a.ZTITLE1, b.ZDATA FROM ZICCLOUDSYNCINGOBJECT AS a LEFT JOIN ZICNOTEDATA AS b ON a.ZNOTEDATA=b.Z_PK ORDER BY a.ZMODIFICATIONDATE1;
  18.  
  19. -- !! Note that ZDATA is a blob (also gzipped). Do something like this in bash:
  20. sqlite3 ~/Library/GROUP\ Containers/GROUP.com.apple.notes/NoteStore.sqlite "SELECT writefile('object0.gz', ZDATA) FROM ZICNOTEDATA WHERE Z_PK = 128;" && gunzip object0.gz
  21.  
  22. -- Attachments are in ~/Library/Group\ Containers/group.com.apple.notes/Media and ~/Library/Group\ Containers/group.com.apple.notes/Previews
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement