Thread:Manual talk:Pywikibot/Script: Remove wanted files from galleries/reply

The delinker.py script could perhaps be used for this, though (afaik) it does require running continuously in order for it to get notified of deletions (it makes the assumption, mainly for scalability reasons, that existing documents don't reference wanted files).

This is also the script used on Wikipedia to unlink files following a delete action on Wikimedia Commons.