How to get the name of the parent folder?

When I use the “Obsidian Custom Attachment location” plugin, the storage path of attachments can be achieved by setting the variable “{filename}”, but if there are many notes, the attachment folder will be very large, so I want the parent folder name As a variable, I don’t know how to write the parent folder variable.
As shown in the figure, I want “TEST attachment” as the attachment folder, but I only did “2022-03-31 attachment”.
My plugin settings are like this

try this

  • ./ needed to say save the attachment within the same folder as the note
  • ${filename}-attachment/ create a subfolder that has your {filename} + “attachment”
    • you can change this. space also seems fine ${filename} attachment/

Thanks for your reply, but what I want is different from what you said.I want the generated folder name to be determined not by the name of the filename but by the name of the parent folder the file belongs to

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