Use the current note name in the attachment subfolder name

I’ve found two different feature requests that are similar to mine but not the same:

What I am looking for is different.

I’d love for Obsidian to be able to create whatever I paste in the folder that I am in, when pasting.

In other words, I might be in:

/personal/books/reviews/50shadesofpink/

…but, if I paste, whatever I paste either ends up in the root or in the folder that I’ve assigned to contain my pasted object.

I’d simply like the folder to differ depending on where in Obsidian I am working at the moment. I’d love not to be in /personal/books/reviews/50shadesofpink/ and subsequently have to drag-and-drop fifty (!) objects from the root to my current location.

Cheers!

6 Likes

+1 I need this feature too,thank you

I support this wholeheartedly!

I never expected this request of mine to be my most popular forum post. :man_shrugging:t2:

I read the thread about open sourcing obsidian and read a very good reply by @Silver on aligning incentives.

So I think I will put up money where my mouth is. I will donate 50 USD for every feature below that is possible.

  1. Upon copy paste an image to a ${filename}.md, and the image can go to ./${filename}.assets
  2. Upon copy paste an image to a ${filename}.md, and the image can go to current folder (./)
  3. I can choose to apply the copy paste rule to in an exclusive OR manner i.e. local images XOR online images

Hope this helps

Tagging @Silver, @Licat who I think are the obsidian team

6 Likes

I need this feature too. Has it been already added?

1 Like

This would be really fantastic. If images (and other files) were automatically copied to ${filename}.assets/ and then linked with a relative path in the .md file, the note would finally open seamlessly in other markdown editors and on other computers (like if the project directory was in dropbox).

2 Likes

+1 would also really love to see this!

I gave this a go using the Templater plugin. It’s a hacky solution for my specific use case but it is working well for me.

2 Likes

@dae @kimstacks
I developed a plugin which allow users to modify attachment folder path and pasted image name with variables(i.e ${filename}, ${date}).

Don’t forget to STAR me if you like it :grinning_face_with_smiling_eyes:.

RainCat1998/obsidian-custom-attachment-location

The plugin only work with obsidian newer than v0.12.17. (Current stable version is v0.12.15, insider v.0.12.19). It’s possible to support older version (just hook cm.__handler.paste) but the solution is not that stable.

@kimstacks

I don’t understand what you mean. Maybe I can help you. You can donate me and I donate obsidian then I will upgrade to “VIP”. :upside_down_face:

7 Likes

@RainCat : Thank you for the plugin! It works very well and is exactly what I needed!!!

I also like to note that the default obsedian file naming causes problems with nextcloud. The Nextcloud web ui does currently not display internal images in md files if the url contains spaces or other characters that are html encoded.

Easy way already implemented

Settings >> Files & Links >> Default Locations of new attachments >> choose a folder

4 Likes

Thanks! it solved my problem!
I choosed “same folder as current file”

In Typora it is possible to automatically create subfolders with custom patterns when adding attachments, or for example when dragging and dropping an image into the markdown file.

When this is done, the image is added to an automatically created folder placed at the same root of the markdown file.

This is done in Typora settings by specifying the following as attachments folder:

./${filename}.assets

So, for example, when dragging and dropping an image to the XXX.md file, this will be the file structure:

XXX.md
XXX.assets\attachment.bmp

Is something like that achievable in Obsidian?

More in general, what are the variables available to be used as custom pattern other than filename?

Best regards

1 Like

I found this plugin which is working well by replicating Typora behaviour:

The core settings are also configurable to: this file’s folder.

Angel

1 Like

Thanks @anon12638239, but by following your solution the attachments of multiple notes stored in the same folder would be created in the same subfolder, which is a behaviour I wanted to avoid (I don’t want to mix attachments of multiple notes storing those attachments in a single folder).

With my solution, each note (i.e. file) will get a private subfolder containing all of its attachments.

Good idea, too bad it doesn’t work.

Hope it comes true as soon as possible

I just want to share this excellent plugin trganda/obsidian-attachment-management: Attachment Management of Obsidian (github.com)

It does all of this and much more. It can even automatically re-arrange/re-name all of your attachments, putting them all in a folder structure like Attachments/note/path/note1/image123.png

1 Like

There’s also GitHub - reorx/obsidian-paste-image-rename: Renames pasted images and all the other attachments added to the vault which handles more than just images

1 Like