Delete unused media

I find careful naming avoids most problems, though that does require remembering what was deleted from the notes.

Separately I use a sophisticated image database and am very used to managing versions, sizes, conversions etc. I’m systematic with images because they clog up so much bandwidth and space. I don’t see a need to use it with Obsidian notes, but it would be a simple matter if I had it select the Obsidian folders to examine.

By “sophisticated image database” do you use specific software to achieve that or do you just mean that you have everything well organized?
If you do use some kind of software would you mind sharing?

I’m asking because this thread’s problem is currently my problem but with a tool outside of Obsidian that would do the trick. That and because managing images outside Obsidian is not something I do particularly well right now as well.

1 Like

I’ve used photools’ IMatch for some time.
There are many alternative digital asset managers, some free, and I’ve tried some of them. This one has been going a long time with a very active user community. Single developer, Mario. Not cheap, but wasn’t the most expensive either last time I looked.

Massive overkill for most people, and it’s best to find a program with the level of function you actually need else you’ll be overwhelmed by complications you don’t understand and will never need.

1 Like

Thanks for sharing.
I’ll look into it and I’ll also take your advice to look for something that might fit me better.

You’re welcome.

A few years ago I’d have been able to make useful suggestions for all types of use, but I’ve stuck in IMatch too long to be up-to-date with what’s gone on outside.

The IMatch community is ultra helpful if your use case matches any of theirs. There’s a lot of people there who really know what they’re doing. I visited often even when I didn’t use the program. They tend to be aware of all the alternatives on the market.

1 Like

Still no proper obsidian?
Anyone has any idea how to get rid of unused photos and media?

1 Like

I think this would be better as a core feature than a plugin. Feature requested here.

1 Like

I think my plugin find unlinked files fixes exact that problem. 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

6 Likes

Thanks for creating the plugin. It’s very helpful. How do you delete all the unlinked files after it open a list of unlinked files in a new pane? I read the readme.md but it doesn’t show you what command to use. Thanks.

Just search in the command palette for delete. It’s called Delete unlinked files with certain extension. See README

1 Like

That’s what I did before I write the message to you. When I select “Delete unlinked files with certain extension. See README” Nothing happen. The Command window disappear and it didn’t delete any unlinked files. Do you think this is a bug with Obsidian v0.13.19 beta. That’s the latest version I’m using.

How do you specify which file type you want to delete? I read the readme.md file but it doesn’t show you how to do it.

@magi44ken

Goes through every link in the output file. If the extension of the link is in the list (can be set in settings), it moves the file to system trash.

There’s a field in the settings pane.

grafik

1 Like

I didn’t know you have to specify the file extension in the plugin setting in order to delete it. I tried three times but it freeze Obsidian. Maybe it have too much files to delete and need to sort before delete? I waited 10 minutes the max.

I have a few suggestions for improvement.

  1. Add: Delete All Files
  2. Add: Delete Image Files
  3. Add: Delete Video Files
  4. Finding Unresolved Files or Links: Show the total number find when viewing the result.
  5. When deleting the actual files, show a progress window of how many files to be deleted and how files is deleted and left during deleting progress.

@Vinadon: thanks a lot for the plugin. Pretty confusing setup, though :slight_smile:

My target was to identify unlinked attachments. Attachments are placed in _resources/ directory.

So, I eventually ended up with these changes to the default plugin options:

  • Ignore or include files in the given directories: Off
  • Directories: _resources
  • Ignore or include files with the given filetypes: On
  • Filetypes to delete per command. See README.: *

Then I ran commands:

  • Find unlinked files and unresolved links: Find unlinked files, which created and opened the unlinked files output.md in root directory.
  • Find unliked files and unresolved links: Delete unlinked files with certain extensions. See README, which deleted the previously identified unlinked files.

As people may be using your plugin for different purposes, it might be helpful to have some kind of “Profiles”, which would remember all the options. Like “Find and delete unused attachments”, “Find and delete unlinked notes”, …

UPDATED: never mind most of that. I see that I was confused that my suggestions were completely off the mark, as I now realized that the toggles don’t mean what I think they mean. Perhaps the toggles should be changed to a labeled toggle that says “only include” and “include all except”.

@Vinadon
I was confused as well by the settings.

For example, the two verbs “Ignore or include” should never be the description of a toggle. Pick one verb and leave out the other; then the user knows that having the toggle enabled means that verb. And whichever setting makes the “File types” setting irrelevant, the textarea for “File types” should become disabled.

The term “unlinked files” should be changed to “orphaned files”. And “unresolved links” should be changed to “broken links”. That way, I wouldn’t have to think so hard.

It’s little tweaks like that would make the user experience much smoother.

Thanks for the feedback. I fully understand the confusion. I renamed many things in a new version 1.6.0. I hope it’s easier to understand now.

there is a plugin for this and I had used it to clean my vault once at the end of 2021.

Its name is “find unlinked file and unsolved links”

1 Like

@Vinadon Looks great. Thanks!

I use this plugin called nuke orphans btw

1 Like

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