JYC333 / obsidian-attachment-name-formatting

Obsidian plugin that automatically rename attachment files' name
MIT License
45 stars 5 forks source link

Plugin not working if attachment folder has subfolders e.g. Vault / Folder / attachments / NoteName / ..... (rename attachment will not work) #44

Open itoldusoandso opened 1 month ago

itoldusoandso commented 1 month ago

Thank you for putting the effort in this plugin.

Unfortunately, the plugin doesn't work if I have attachments here:

Vault / Folder / attachments / NoteName / .....

I tried the configure the in Obsidian Settings / Files and links ... field Subfolder name to this:

_resources/${notename}

Doesn't help and the plugin can not accept it, so it doesn't work.
I need to rename attachments to match the note name + index suffix.

image

It only works if I run this plugin for a specific folder only (I have to specifically select the subfolder with attachment). The issue with this (aside of the fact I have to repeat this 1000's of times) is when this plugin is executed on the specific folder, then the the plugin will overwrite the Obsidian Setting in Files and links .. field Subfolder with this entry:

image

The next time I try execute the plugin on another folder, it doesn't run anymore correctly because now the Subfolder is pointed into the specific subfolder.

The way to solve this issue is for the plugin to support the variable notename so I can indicate the attachments are here: _resources/${notename}

Since the Obsidian setting in Files and links does not support notename variable, this setting will need to be as an override option inside this plugin.

The plugin is now designed to only run if the attachments are directly in the attachments folder e.g. Vault / Folder / attachments .....

I am using Attachment Manager to move attachments into subfolders as soon as attachments are added into the note.

So I hope if the plugin here can be modified to allow supporting Vault / Folder / attachments / NoteName / .....

image

3fok commented 1 week ago

In my case I waint the folder like this: image

How to do it:

itoldusoandso commented 2 days ago

So right out of the bat, I throw in the commands in the terminal on MacOS?