This script will call Doveadm-Expunge based on users in home directory.
#!/bin/bash
FOLDERS=/home/*
for f in $FOLDERS
do
doveadm expunge -u "$(basename $f)" mailbox Spam savedbefore 14d;
doveadm expunge -u "$(basename $f)" mailbox Trash savedbefore 7d;
done
Hi,
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.