Auto-create attachment folder and allow dots in folder name (.media for instance)

Use case or problem

Obsidian allows you to set an attachment folder as a sub-folder of the current file. However, these folders are not auto-created and you cannot name them with a dot (.) as the first character, such as “.media”

The workflow right now is:

  • manually create the folder name such that it matches the name set in the files settings
  • drag a file into the editor

If you don’t manually create the attachments dir under the file you’re editing, the attachment lands in the same folder as the document. If you have the folder name set to something that starts with a dot, then you can’t attach files at all, it just silently fails.

The workflow should be:

  • drag a file into the editor
  • Obsidian creates the attachment folder if it doesn’t exist and places the file there

Proposed solution

Keep the existing settings, but when you drag a file into the editor, create the attachments directory if it doesn’t already exist.

Current workaround (optional)

Manual steps listed above. If you mis-spell the folder you manually created nothing will land there.

3 Likes

Creating a .media directory was one of the first things I’ve tried when setting up Obsidian. And it just silently failed :frowning: So I made _media, but I don’t want to see it.

The ideal way how I’d want this to work would be:

  • Store all attachments in a root .media or .attachments folder which is invisible in the default file tree.
  • Have a separate little tab above the file tree (next to search tab) where all attachments are listed.
  • Next to each attachment have a counter of how many files are linking to it.
  • Attachments linked by 0 files are in red.
  • Have a button above the list to delete all unlinked attachments.
2 Likes