Skip to content

Instantly share code, notes, and snippets.

@IanMulvany
Created July 11, 2016 23:04
Show Gist options
  • Save IanMulvany/71d832a84c7ca2d5c609401401ee231a to your computer and use it in GitHub Desktop.
Save IanMulvany/71d832a84c7ca2d5c609401401ee231a to your computer and use it in GitHub Desktop.
from glob import glob
def get_note_title(filename):
title = filename.split(".")[0]
return title
files = glob("nv-bear-import/*")
for f in files:
title = get_note_title(f.replace("nv-bear-import/",""))
with file(f, 'r') as original: data = original.read()
with file(f, 'w') as modified: modified.write("# "+title+"\n" + data)
print "rewrote " + f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment