Remove All Spam and Trash from Server

A buildup of spam and trash in user accounts can occupy several gigs worth of space. To easily remove spam and trash from your users’ accounts, you can use the following commands:


rm -rf /home/*/mail/*/*/.spam/*
rm -rf /home/*/mail/.spam/*
rm -rf /home/*/mail/*/*/.Trash/cur/*
rm -rf /home/*/mail/*/*/.Trash/new/*


rm -rf /home/*/mail/*/*/spam
rm -rf /home/*/mail/spam
rm -rf /home/*/mail/INBOX.Trash
rm -rf /home/*/mail/*/*/INBOX.Trash

To delete the cPanel trash folders:

rm -rf /home/*/.trash/*

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *