This script will call Doveadm-Expunge based on users in home directory.
for f in $FOLDERS
doveadm expunge -u "$(basename $f)" mailbox Spam savedbefore 14d;
doveadm expunge -u "$(basename $f)" mailbox Trash savedbefore 7d;
2 thoughts on “Doveadm-Expunge bash script”
1) What would happen if user has a spacebar in his username? (“for” won’t work) You are missing -> “$var”
2) What about other folders where messages have been flagged as deleted but have not been moved to Trash or Spam folders?
I did not need flags, in my case deleted messages are moved into the trash. You will have to adjust the script.