Skip to content

Instantly share code, notes, and snippets.

@DustinAlandzes
Created December 13, 2019 18:02
Show Gist options
  • Save DustinAlandzes/2fe249252c017b15d333bc01a44d2cb8 to your computer and use it in GitHub Desktop.
Save DustinAlandzes/2fe249252c017b15d333bc01a44d2cb8 to your computer and use it in GitHub Desktop.
Used this script and https://writeapp.net/notesexporter/ to export text from notes.app
import os
from markdownify import markdownify as md
import sys
print(sys.getdefaultencoding())
NOTES_PATH = "/Users/f00/Documents/notes-backup"
notes = os.listdir(NOTES_PATH)
for note in notes:
with open(f"{NOTES_PATH}/{note}", 'r+', encoding="ISO-8859-1") as f:
note_data = f.read()
f.write(md(note_data))
for note in notes:
os.rename(f"{NOTES_PATH}/{note}", f"{NOTES_PATH}/{note[len('Notes'):].replace('.txt', '.md')}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment