Batch rename files, preserve internal links

Things I have tried

This thread looks to be similar, but to be frank, I’m no good with command line. Hoping there’s another way.

What I’m trying to do

I’m trying to batch rename thousands of notes but preserve hundreds of internal links—specifically, to “prettify” the names of chapters of the Bible I downloaded - turning “1cor15” into “1 Corinthians 15”

I used NameChanger to successfully rename and sequence the notes, but as I feared, when I opened Obsidian again, all my internal links broke.

Is there any way for me to batch rename note files and somehow have Obsidian update links? Or, a way to mass-update links using a similar “find and replace” rule?

3 Likes

I’ve tested one, but it is such inefficient that I don’t think it’s better than using command line.

You could use /\[\[[0-9]+cor[0-9]+\]\]/ to search the content which looks like “[[1cor15]]”, then replace them from “cor” to " Corinthians " manually. Notice that the regex is not case sensitive. You could use hotkey to make this a little faster, and don’t forget the space nearby “Corinthians”.

Snipaste

I don’t think there’s a plugin yet for this. So i suggest explore option using external app to do bulk search n replace. Either vscode or atom would do the trick since they can open folder as “vault” similar to obsidian. See post below

Ah, this may do the trick. I’ll dig in tonight. Thank you!

Oh my - that worked. THANK YOU. For anyone who may need to do this in the future, I ended up using a combination of tools:

  1. NameChanger to do a simple find and replace of the file/note names
  2. VS Code to find and replace the links inside the files/notes (e.g. searching for “[[1john” and replacing with “[[1 John”

In hindsight, I’m sure I could have used VS code for both steps.

Thank you!

3 Likes

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