How to remove invalid/dead links (to media etc) from fields

Anki is capable of removing unused media,

but how to remove unused (invalid) links?

There was an addon for Anki 2.0 Remove Missing Audio References - AnkiWeb

Also, we can use Anki’s Tools>Check Media function to find out which images are missing from collection by looking at the “Used on cards but missing from media folder” section - but there’s no option to remove these dead links.

Plus, back in 2013 there was a discussion Missing media files - remove invalid links / Anki Archive / Discussion Area - AnkiMobile/AnkiWeb Support (tenderapp.com)

Damien even paid some attention and noted this for possible implementation.

Are there any native ways or addons to delete dead links from Anki’s notes?

(In my case, the following task requires this functionality:
I have a few thousands of mp3’s with Chinese pronunciation with names equal to the words (Hanzi). I want to batch these words to the Audio field, and then delete the ones which doesn’t have their mp3 (the number of words/notes = 100k+, while only about 6k audio files).
The deletion is necessary since I’d like to activate TTS for those words without mp3’s. But if the Audio field has a link (even broken/invalid), then TTS wouldn’t speak)

1 Like

I have the same problem here!
I’ve installed Anki 2.0 and the add-on you mentioned but I failed to import my collection exported from Anki 2.1 to 2.0…
And 2.0 cannot open user of 2.1. So basically I can’t do anything about it for now.
Is there a workaround for this?

@dxxxxp Try this Add a tag to notes with missing media - AnkiWeb

1 Like

Thanks for your advice.
I’ve tried to edit my decks on Excel a few weeks ago with this add-on:
https://ankiweb.net/shared/info/1832015432
Using excel to displace the invalid links in bulk is easier for me since I know nothing about coding. I wrote a tutorial in the review column.
Most of cards got fixed perfectly but some of them didn’t ’cause I didn’t take css tags into account.
The add-on you recommended seems to make my workflow easier. The add-on called Anki Excel Sync actually needs you to add tags to the notes you want to amend. I’ll try again.

1 Like

Any new solution for this in 2025?

As mentioned in the addon linked in the thread, Anki now has a feature to add tags to any notes with invalid media links.

Now you could do what the original poster wanted to do like this:

  1. Use Advanced Copy Fields addon to create the potential file name
    • Use custom option and input into your desired field, e.g. Some_Field the value [sound:{{Another_Field}}.mp3] (Adjust file name as needed for your case)
  2. Manually move the audio files to the collection media folder
  3. Perform Check Media, use the Tag Missing button to tag all the notes where the added audio file didn’t exist (though it will in fact tag any and all notes with any invalid media link)
  4. Search for tag:missing-media (if needed, adjust the search to only target the specific note type or deck you added the sound files)
  5. Select all the notes found and use Advanced Copy Fields or the basic Anki regex search+replace to empty the note field Some_Field

Result: only the notes where the audio files did exist would then have Some_Field containing the audio file reference.

1 Like

The issue is that my missing media is not the only media in the field, I.e., there is both missing and non missing media in the same field, so I would have to manually go through and delete them for the hundreds of cards+ that I have with partially missing media. Why is there no simpler solution for this?

  • Can you explain more about your use case? Why you need to remove that missing-media related text at all? It seems like if it’s buried in a field with a bunch of other things, it couldn’t be getting in your way very much.
  • Are these [sound:…] tags, or HTML links or imgs?
1 Like

I just don’t like the way the missing photos look. They are image file links, wherein the files are missing and cannot be obtained. My use case is for about 699 notes which for some reason reference missing media. These are not in a particular field, so it seems like i’d have to manually go about and hand delete each one.