I have a folder with over 12k notes in it. They have unhelpful titles like ‘D1650’ and ‘J1051’.
The name I really want for the note name is located in the first (H2) header within each note. E.g.
‘D1650 Other Characteristics Of Magic Objects’
or
‘J1051 Death’s Three Messengers’
Things I have tried
I started off using the primitive macro utility in Microsoft Keyboard and Mouse Center, manually placing the cursor at the beginning of the first header (but after the pound signs, e.g.
‘## [CURSOR HERE] D1650 Other Characteristics Of Magic Objects’ → run my macro
I worked at this for about 90 minutes before I realized it might have been faster to figure out how to do it with scripting.
Then I saw that the next folder I want to do has over 12k notes (can’t do it manually in a reasonable amount of time).
I saw the plugin Obsidian Filename Heading Sync, which does almost exactly what I want, only in reverse. I want to update the filename to match the first header, instead of the other way around.
I looked at doing it outside of Obsidian, but I would lose all the existing links.
Don’t be too eager on stating something like this, based on your own assumptions and after only a few hours.
It’s actually somewhat easy, if you know coding, since the headers are readily available in the metadataCache, and you’ve got proper rename tools accessible through various API’s. I.e. Templater.
Doing this through a python script though is a lot more work. I’m never going to advocate using AI to write it, but that aside you’ll need to handle all internal link renaming with that script, and that is not an easy task.
All in all, as the OP discovered there is already a plugin written for this task, so my advice in general is to try not to be too categoric/final/… in your answers, especially if you’re not very safe on the quality of your answer.
The question was posted just a few hours ago, and you jumped the gun with an answer which contained wrongful assumptions.
Knowing scripting by years of experience I doubt for that script to handle internal link renaming correctly in such a complex user space as Obsidian links are. So I doubt that script correctness unless loads of precautions has been taken.
Especially since this is a public forum I believe care should be taken not to present potentially hurtful/wrong advice, and be humble about us all being human with not knowing all aspects of the inner and outer working of Obsidian.
The other end don’t know what we know or not know, so they’ll easy take our advice to be the truth, even if it’s not even close to being so. So I try to be careful in that aspect, so as not to misuse this power.
I’m going to step away from this now, as the thread has been resolved with a good solution. And I’m not here for any reward, I just strongly believe in being open ended and allow for the community to speak and showcase various options to solving a request.
the old title will be used with a regex search – regex because we want to account for any aliases – to search the content of all files and updated with the new title in a loop – as I said, in 4-5 tries anyone will sort out the kinks and over time give themselves a chance to learn to be self-reliant…
…or should we all wait for the prospective de facto winners of digital king of the mountain contests?..