Duplicate file handling

Not sure what is happening lately with my downloads, but i have been noticing multiple downloads of episodes. Specifically, when a release is upgraded (quality), the lower quality version is not always removed. In the end I am left with HDTV and 1080p webdl. It does not happen every time, but it has been more frequent of late, so thought to ask.

I was wondering if there was a way to scan and have this detected and mass delete as an option, but more importantly, I am not sure where the issue falls, if it is me or sonarr. regardless, let me know what might be needed to try and detect/resolve the cause.

Before attempting the upgrade Sonarr will remove the existing file, if that fails Sonarr will not import the episode. Debug logs would be the first thing to look at, which will show the deletion and the import of the new file.

Sonarr only tracks one file per episode (one of the reasons it deletes it) and I think its better to solve the underlying issue than add in a kludge to deal with it (solve the problem, not the symptom).