How to empty all Trash and Spam folders

Post Reply
User avatar
myVesta
Site Admin
Posts: 936
Joined: Fri Jun 19, 2020 9:59 am
Has thanked: 8 times
Been thanked: 6 times

In SSH, as 'root', run:

Code: Select all

USER='*'    # enter user if you don't want * users (*=all)
DOMAIN='*'  # enter domain if you don't want * domains (*=all)
MAILACC='*' # enter mail account if you don't want * mail accounts (*=all)
find /home/$USER/mail/$DOMAIN/$MAILACC/.Spam/new/ -type f -delete
find /home/$USER/mail/$DOMAIN/$MAILACC/.Spam/cur/ -type f -delete
find /home/$USER/mail/$DOMAIN/$MAILACC/.Spam/tmp/ -type f -delete
find /home/$USER/mail/$DOMAIN/$MAILACC/.Spam/ -type f -delete
find /home/$USER/mail/$DOMAIN/$MAILACC/.Trash/new/ -type f -delete
find /home/$USER/mail/$DOMAIN/$MAILACC/.Trash/cur/ -type f -delete
find /home/$USER/mail/$DOMAIN/$MAILACC/.Trash/tmp/ -type f -delete
find /home/$USER/mail/$DOMAIN/$MAILACC/.Trash/ -type f -delete
systemctl restart dovecot
Post Reply