Have multiple templates notes created and added upon new folder creation

What I’m trying to do

Is there a way to have notes (templates) automatically added to a new folder upon the creation of the folder? For example, when I create a new folder for a specific project I have standard template notes that I add for each project (e.g. a dashboard note and a note for tasks). I’d love to have the templates for each of those notes automatically added to a new folder when I create the folder for the project.

I’m guessing there might be a way to do this with templater? I’m just now dipping my toes into learning and using templater, but so far all I’ve been able to figure out is how to have a specific template added to a new note when created in a specified folder, and it looks like I can only have one template per folder.

Things I have tried

I haven’t been able to figure anything out yet and haven’t found anything on this specific topic in my searches.

I’ve not heard about any triggering of a template when creating a new folder, but if you flip it around and create your new folder from a template it should be easy to create any extra files you want in that folder at the same time using tp.file.create_new().

Just to amplify what @holroy is saying, rather than creating the folder, create one of the project files using a templater template. That template could do the following:

  1. Create the project directory (await app.vault.createFolder(projectDir))
  2. Create the other templater files using await tp.file.create_new in the new project directory
  3. Copy the project file into the new directory (using await tp.file.move)

I’ve done some similar things. As @holroy says, this is all sounds very doable. Note that the "await"s are important to prevent race conditions.

Thank you guys for the help and advice. I’m having a hard time wrapping my head around this templater stuff and how it all connects. Do all three steps you outlined above have to be three separate files with the templates, or can I run all that at once?

One template to rule them all, so to speak. You just need that one template to do it all, but depending on your needs for the files it creates you can consider having other templates for them.

I realized there was another way to do this that you might find easier. You could use the QuickAdd plugin by Christian B.B. Housmann. This avoids writing javascript which the above solution required. So, if that’s the issue, here’s an alternative.

You would create a macro (one macro to rule them all). Inside the macro you use a template command for each file you want to create. The macro looks something like:


Then each of the template commands looks roughly the same. Here’s the one for the Master project file:

and the associated template

Here’s the one for a project document Note
and the associaged template

The third step in the macro is extremely similar.

Note the “{{VALUE:Project Name}}” variable is used throught. I used this same variable in all of the templates and template commands so that QuickAdd would only ask for it once.

One thing to note is that Quickadd has a bug that when you add new template commands or Macros, they don’t get registered properly. The way around this is to stop and restart obsidian.

If this seems confusing, I’d look at several of the QuickAdd youtube videos (I recommend Nicole van der hoeven, Danny Hatcher or QuickAdd’s author Christian B.B.Housmann) for how to use QuickAdd

Just another possibility

1 Like

Thanks so much for the replies and suggestions! I appreciate the possible solutions from different methods. I’m still trying to learn the templater stuff - having a hard time wrapping my head around the basics of that. Currently trying to look into that QuickAdd plugin more. I just haven’t figured out how to run multiple commands at once from it (i.e. run it and have several different template notes create at once).