Remove unused attachments

Its hard to delete every attachment after deleting a file. And if there are lot of files in attachment folder its hard to find that specific attachment
Maybe while deleting file there should be pop up asking if user wants to delete attachments too


I’d like to see this as well. For example a button you could press and remove attachments that aren’t used.

This has previously been suggested as a plugin here: Delete unused media


I believe it would be extremely useful to have an option to remove all media associated with a note/file if there are not any active references to it in any other notes.

I tend to regularly drag images (screenshots, etc.) into notes when in meetings, and while I can certainly iterate over all files in the vault, grep for their presence in all of the notes, etc., that’s not necessarily something that all users will have the skills to do, or will even feel comfortable doing.


Use case or problem

There is a note. It has embedded files. These are usually images, possibly sound, etc.
Now, when you delete a note, all embedded files remain in the storage, which leads to a littering of the system

Proposed solution

You need an additional feature so that when you delete a note, the embedded files are also deleted

Current workaround (optional)

You have to delete these files manually.

Related feature requests (optional)


There should be an automagic way to remove orphan attachments.
I suggest the following: when deleting a note which contains the last link to an attachment, there should be a warning After deletion of this note the attachment ... will become orphan. Delete attachment ...? (Yes/No)


Same demands, that’s really a natual but missing feature.

I think my plugin find unlinked files is a good solution. It finds files (also attachments) which are nowhere linked (orphans) and lists them in an output file. With an extra command you can delete all files listed there with a certain extension. You can choose which extensions to delete in the settings. In this case it could be .jpg


This feature is critical for those who are bringing a large legacy database from Evernote (say) to markdown.

The .enex export contains a MYRIAD useful and useless files that were attached to the original HTML clippings, which are then imported to .md (using the life-saving application yarle).

My obsidian vault now contains 1000s of such useless files linked from the _resources folder to the .md files, and as I clean up the HTML advertising and recirculation tags in the .md files, they are all just lying there in _resources.

Any such feature rollout should (ideallly) not only delete orphans as they form, BUT be able to delete legacy orphan files (such as mine).


1 Like

I would like to check before deleting, so I hoped for creating a Dataview, but that plugin seems unable to see anything apart from *.md:

from "Anhänge"

Dataview: Query returned 0 results.

(where “Anhänge” is just the German word for “attachments”).