# Batch rename files, preserve internal links

**URL:** <https://forum.obsidian.md/t/batch-rename-files-preserve-internal-links/40841>\
**Category:** Help\
**Tags:** internal-links\
**Created:** [July 24, 2022, 9:22pm UTC](https://forum.obsidian.md/t/batch-rename-files-preserve-internal-links/40841 "2022-07-24T21:22:09Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rostehea](https://forum.obsidian.md/user_avatar/forum.obsidian.md/rostehea/32/32550_2.png) [@Rostehea](https://forum.obsidian.md/u/Rostehea)\
**Post date:** [July 24, 2022, 9:22pm UTC](https://forum.obsidian.md/t/batch-rename-files-preserve-internal-links/40841/1 "2022-07-24T21:22:10Z")

</div>

### Things I have tried

[This thread](https://forum.obsidian.md/t/how-to-update-internal-links-in-bulk/11674) 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?

---

<div class="post-metadata">

**Author:** ![moz](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/m/48db29/32.png) [@moz](https://forum.obsidian.md/u/moz)\
**Post date:** [July 25, 2022, 8:26am UTC](https://forum.obsidian.md/t/batch-rename-files-preserve-internal-links/40841/2 "2022-07-25T08:26:56Z")

</div>

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](https://forum.obsidian.md/uploads/default/original/3X/4/4/4402b1ea2cad4a1afadad6dab109e053649d87a4.png)

---

<div class="post-metadata">

**Author:** ![efemkay](https://forum.obsidian.md/user_avatar/forum.obsidian.md/efemkay/32/26644_2.png) [@efemkay](https://forum.obsidian.md/u/efemkay)\
**Post date:** [July 25, 2022, 4:09pm UTC](https://forum.obsidian.md/t/batch-rename-files-preserve-internal-links/40841/3 "2022-07-25T16:09:45Z")

</div>

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

> [@Is anyone aware of ANY way we can delink/unlink mentions efficiently?](https://forum.obsidian.md/t/is-anyone-aware-of-any-way-we-can-delink-unlink-mentions-efficiently/32997/6):
>
> on top of @unrelated suggestion on using sed, awk or grep, and if u need a solution right now, i highly suggest using [vscode](https://code.visualstudio.com/) to achieve the very same thing. once u have vscode installed u can open your vault with File \> Open Folder and choose your Obsidian vault. then use Find in Folder... to search and replace content of your notes/files. vscode is better at bulk search and replace. u can see at my screenshot below that u can choose to replace only certain links or all links it found.

---

<div class="post-metadata">

**Author:** ![Rostehea](https://forum.obsidian.md/user_avatar/forum.obsidian.md/rostehea/32/32550_2.png) [@Rostehea](https://forum.obsidian.md/u/Rostehea)\
**Post date:** [July 26, 2022, 2:51am UTC](https://forum.obsidian.md/t/batch-rename-files-preserve-internal-links/40841/4 "2022-07-26T02:51:28Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Rostehea](https://forum.obsidian.md/user_avatar/forum.obsidian.md/rostehea/32/32550_2.png) [@Rostehea](https://forum.obsidian.md/u/Rostehea)\
**Post date:** [July 26, 2022, 3:08am UTC](https://forum.obsidian.md/t/batch-rename-files-preserve-internal-links/40841/5 "2022-07-26T03:08:32Z")

</div>

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](https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=&cad=rja&uact=8&ved=2ahUKEwjIlYOcyZX5AhV4DEQIHZNXBlkQFnoECAoQAQ&url=https%3A%2F%2Fmrrsoftware.com%2Fnamechanger%2F&usg=AOvVaw1ec-gQzsVvqLeujIlCXKyb) 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!

---

<div class="post-metadata">

**Author:** ![system](https://forum.obsidian.md/uploads/default/original/3X/b/e/bec35fbd23ab28909bb6bfe62cb32eb82dd34019.png) [@system](https://forum.obsidian.md/u/system)\
**Post date:** [August 2, 2022, 3:08am UTC](https://forum.obsidian.md/t/batch-rename-files-preserve-internal-links/40841/6 "2022-08-02T03:08:38Z")

</div>

Closed on August 2, 2022, 3:08am UTC

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