How to automatically insert current date in a filename?

Problem description

How can I insert the current date as a filename of the newly created note?

Ideally, I would like to see an option to automatically create all the new notes named with a date (like 2022-08-11), since presently I can only use the Open today's daily note button, which creates such notes merely in a single specified folder. It would be even better if Obsidian could apply different templates basing on the defined folders, such as use 2022-08-11 (meeting x) in folder A, and 2022-08-11 (event y) in folder B.

Things I have tried

I have tried using Templates: Insert current date from the command palette, but it only works for the note content. The same applies for using the Natural Language Dates or Text Snippets plugin, which only work within the note content.

2 Likes

You can use the Unique Note Creator Core Plugin. You cannot chose varying folders, however.

2 Likes

Thanks! It helps a little, and I am mainly missing an option to create new pages in the same folder as the currently opened file.

You could open a feature request, maybe for an option within the “Unique Note Creator” plugin to toggle it’s default behavior: Either chose a default folder or create the note within the current folder.

You should NOT use unique note creator plugins because it is meant for different purpose (UNIQUE PREFIX).

Open a FR for the core “templates plugin” and/or use the third party “templeter” plugin.

Isn’t that what @pyxelr is looking for? Maybe I misunderstood his request…

1 Like

Actually, it would be great if the Unique note creator would have the same option, as in the Options > Files & Links section (Default location for new unique notes: Same folder as current file).

Nevertheless, I am just viewing the templater plugin, as it seems like it offers what I need, but it will require some time to understand its usage.

1 Like

You can do it without community plugins if you create notes from links.

  • Make a template of a link to the date plus placeholder text (I’m not looking up the date syntax, but like [[{{date:YYYY-MM-DD}} NOTE]].
  • Set Settings > Files & Links > Default location for new notes to Same folder as current file.
  • Thereafter, use the template in a note in the desired folder, then click the link.

In community plugins: besides Templater, I think Quick Add might have basic templating that includes what you want (can’t promise, haven’t started using it yet).

1 Like

One of the possible solutions I have found so far, with templater, is to:

  1. Create a templater note: <% tp.file.rename(tp.date.now() + " meeting x") %>
  2. Open templater settings and assign a hotkey for this template.
  3. Create a new file (note) in the desired folder with CTRL + N.
  4. Rename the page by using the assigned hotkey in step 2.
  5. Optionally, fill out the page template using the Templates core plugin.

Perhaps, I could automate it even further, but it is already good enough.

2 Likes

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