Hi all, I came across this post on moving obsidian vault into dendron "Effortlessly" open your obsidian vault in dendron!, Is there any way to go reverse?
NVM I just wrote this if anyone is interested.
import glob
import shutil
import os
def applyrecurse(path):
if path.count(".")>1:
index = path.find(".")
foldername = path[:index]
newfilepath = os.path.dirname(path) + "/" + os.path.basename(foldername) + "/" + os.path.basename(path[index+1:])
if not os.path.exists(foldername):
os.mkdir(foldername)
os.rename(path, newfilepath)
applyrecurse(newfilepath)
for filepath in glob.iglob('./*.md'):
print("file path is ", filepath)
applyrecurse(os.path.abspath(filepath))
Hi
I am new to Obsidian.
How do you use this JS code in Obsidian to import Dendron vault?
Thanks in advance
It is python code, you have to save the code in a file with a .py extension in your dendron’s vault folder and run the file in the terminal after.
Thanks, it works like a charm!
Hi.
Judging from your python script, I’m understanding that it converts only the dot-type filename into folder-type files. It does not take into account of Dendron-specific markdown syntax, does it?
I wonder why don’t you use the export to markdown pod developed by Dendron instead?
super helpful for my desire to do exactly this and migrate backwards. thanks!
I found a case where this python script fit better than the exportMarkown pod by Dendron
- the export pod will change the transclusion syntax ![[]] by inserting the transcluded content into the current note, because transclusion syntax is not supported by markdown
- while the python script does not touch the syntax conversion