Remove unused attachments

Hi everyone! Has this just been dropped suddenly? Or is it implemented and I have not found it? I am only starting with Obsidian now, but can already tell that my attachments folder will be a huge mess if this is not available. Specifically when dragging a lot of screenshots into the notes, that usually do not have names suggesting their content.

1 Like

This is an open feature request.

Above, youā€™ll see a workaround using a plugin. (I havenā€™t tested it personally.) Remove unused attachments - #7 by Vinadon

4 Likes

Thanks for the quick reply! @rigmarole Iā€™ll check out the third party plugin then.

Thereā€™s also a new plugin called Janitor that does this (and other things)

6 Likes

Iā€™ll check on the suggested plugins after I made progress on post import cleanup from Evernote.

My attachments folder currently has over 18k files in it. After I remove notes that whose only content was an attachment (think, pdf document) , Iā€™ll run a plugin and see how many it cleans up.

This feature works be a great core feature imho. Maintaining a file reference count and deleting the file when the count hits 0 isnā€™t a small task, though.

1 Like

Perhaps itā€™s better to move those files in a folder ā€œattachments_not_in_useā€ instead of more or less blindly delete them.

1 Like

A temp location could be handy in case you restore a note that you deleted by accident. or we can say that the used is responsible for restoring it from the ā€œtrashā€ folder or from backup.

ie
User deletes last note that references an attachment.
Obsidian deletes attachment
User restores note
attachment link is now broken.

Totally agree with the need of an ā€œautomatic removalā€ of attachments after a note was deleted. It is painful to do this manually and really a bummer when using the app with attachments. Please add something that takes care of this.

3 Likes

If you read the thread, there are plugins that do this.

1 Like

I use this plugins called nuke orphans btw

čæ™äøŖę‰©å±•éžåøøę£’
This extension is great!

Use case or problem

I would like that if I delete a note, I would be asked what to do with the documents linked in it, if they have no other references, whether to keep them or delete them.

Proposed solution

When I delete a note I would like that if there are linked media that are only in that note, I would be asked whether to keep them or delete them

Current workaround (optional)

All files remain