Move vault files by Obsidian command line option or URL to allow scriptable link updates

I prefer to programmatically move notes between directories with a script. This allows me to automatically refile notes containing certain terms or select the desired directory with fzf. If I do this, however, the links inside of my notes break because Obsidian is not aware of the location change.

I would love to see a feature added to Obsidian allowing the user to move files with a command line option (or possibly a specialized URL scheme.)
That way, users could write scripts to refile their notes, and Obsidian could keep the links up to date.

Here is an example of the kind of workflow this script would enable.

1 Like

That’s not my experience when I move notes. I’ve never had link broken. I do use shortest path though.

1 Like

I was using the relative path option. I tried enabling the “Shortest Path” option, and the links still work (provided the name is unique) when I move the file outside Obsidian.

Unfortunately, not using relative links means I can’t follow the links in programs other than Obsidian, but it’s good to know this is available as long as I’m willing to give that up.

I think you need unique file names - I use them because they have a wider utility - but comments on the discord suggest that Obsidian renames any clashes. I haven’t tested.

Full path might work, but I dislike the general fragility given how often mine change.

I agree about needing unique filenames for your personal notes. I was just trying to break the auto-link updating, and that was the only way I could do it.

Full path has the same problems as relative path. The links only update if the file is moved within Obsidian.

Yes, of course it would! Not sure what I was thinking.

Obsidian could add search for files in broken attachments, but presumably that would involve giving up the use of uncompleted links.

Presumably, in theory, you could have a macro which automated doing it in Obsidian.

I have a similar request but to make it work moving files between different vaults (either programmatically or non-programmatically), which may be more related to Broken links in relative path mode on move/rename but for between vaults instead of to subdirectories.