Name change in filesystem does break links


I have a script which changes indices of some notes automatically.
But I’ve noticed when I change the name of a note in the filesystem it does not alter the links accordingly. Instead the existing links now reference a no longer existing file, creating it upon click.
This is of course no option since I cannot manually change the name’s of hundred’s of links.
Maybe I could use JS to automate that task but does anyone have a better solution ?

Thanks in advance <3

This probably isn’t what you are looking for, but personally I would just use a mass search and replace within VSCode. You probably consider this to be manually adjusting them, but I figured I would mention it just in case.

There is a feature request to implement this within Obsidian if you are interested: Global (Mass / Vault-wise) search & replace

Good luck.

1 Like

Thanks a lot for the suggestion.
Yet this is not really what I’m looking for, since sometimes the name changes include hundreds of files. Even if I’d find and replace every instance of one of them this would be a Sisyphus task.

1 Like

Maybe you could figure out a way to use regex with the search and replace. I’ll add a link to my attempt to explain a process of doing what would have been impossible otherwise. Again, you probably are well aware of this already: Note Composer: links to blocks and headers should be updated when extracting - #10 by I-d-as

Good luck! I hope you get it figured out. I am interested to hear what others recommend. Maybe you could give a few more details of the specific syntax or just provide actual examples. I’d be surprised if someone didn’t help you make at least some progress. It’s definitely a topic that people have conversed about in other threads.

1 Like

Obsidian is, essentially, an interface “sugar” on top of a regular folder of text (.md) files. It does hook some kind of “find and replace” action to the process of renaming a file through its interface but it doesn’t really track or manage files in the long run. It lets you open and browse any folder you have at the state it’s currently in.

I’d look for a solution on your script side. There are rules by which the script determines which files should be changed, when and in what way. You probably want to adjust the script to store both the old and the new name in a variable, run a regex search for [[$old]] and [[$old|*]] patterns and do all the relevant replacing for you at the same time with those other changes. It’s much more trivial to perform such operations along with renaming than to try and track changed files after the fact.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.