I’m also trying to move from Bear to Obsidian, attachment doesn’t work from this post. I got something to fix that
import urllib.parse
import re
import os
for root, dirs, files in os.walk("./"):
for file in files:
if file.endswith(".md"):
# f_base_name = urllib.parse.quote(os.path.basename(f_name))
# print(f_base_name)
f_path = os.path.join(root, file)
p = re.compile(r"(.*)<a href.*>(.*.PDF)</a>(.*)", re.IGNORECASE)
f = open(f_path, 'r+')
file_contents = f.read()
file_contents = p.sub(f'![[\g<2>]]', file_contents)
f.seek(0)
f.truncate()
f.write(file_contents)