🍿 Auto-create folders in Obsidian by using format strings
Snacks (🍿) are my collection of recipes for solving problems. Often recorded (and cleaned up) from actual discussions where I'm involved in helping others with technical problems. Not all solutions are mine but I started collecting them in one place because you never know when you need one.
In Obsidian, you can make plugins auto-create folders by defining the file format string to include /
.
For example, I use Periodic Notes plugin and I have defined the daily note format as: YYYY/YYYY-MM/YYYY-MM-DD
. Whenever a new daily note is generated, it checks if a folder matching the pattern YYYY
exists and if not, it will create one. It then checks if YYYY/YYYY-MM/
exists and if not, creates one. Finally, it creates a note named YYYY-MM-DD.md
inside that folder.
It's a very handy trick that works pretty much everywhere in Obsidian. Even if you name a note and use /
inside the name, it'll create all the folders it needs. I've ran into this so many times accidentally when I forget you can't use forward slash in note names.