I use mutt for that which modifies local maildir so it's super fast. Commands are: "D~=$". Then it's just a matter of syncing local changes back e.g. with mbsync.
Thanks. I suppose I should take another look at mutt. When I have in the past it's seemed a bit overwhelming with features & config. Does that command remove dupes in a single folder or a hierarchy?
It works in a single folder only. It's actually a set of the following commands:
- D tells mutt to delete messages by pattern
- ~= is pattern which selects all the dupes in current folder
- $ finalizes the command
I think this [1] is where I learned about it and there's also a handy folder hook for mutt which automatically removes duplicates when you open the folder.