So I have a script for handling my specific archive and expunge needs, but it’d be nice to be able to track how many messages are being affected.
Currently I’m doing it by firing the same search queries into doveadm search and counting the lines of the result with wc -l, but that’s not a very pretty solution. While I’m mostly doing it out of interest on a personal server, I can’t imagine it’s a very scalable way to do it if you wanted to gather some kind of metrics for example.
What I think would make sense would be for relevant doveadm commands such as move, expunge (probably purge too) and others I haven’t thought of to have a new option that, if enabled, will cause the command to output the number of messages affected as the final line of output (most of these commands don’t have any output anyway). A doveadm count command could also be a convenient, more efficient, alternative to doveadm search | wc -l.