View Single Post
Old 17th August 2012, 19:00
EckyBrazz EckyBrazz is offline
Join Date: Jul 2012
Location: Goi‚nia, Brazil
Posts: 37
Thanks: 3
Thanked 4 Times in 1 Post
Default Script to clean up old Trash, Junk and Spam mail.

Hi Folks,

Just found a script that I have adjusted to work with ISPConfig 3 to clean up the old trash mail ect.

MAILDIRS=$(find /var/vmail/*/*/Maildir/ -maxdepth 0 -type d)
for basedir in $MAILDIRS; do
  for dir in .Trash .Junk .Spam .Low\ Priority; do
    for dir2 in cur new; do
      [ -e "$basedir/$dir/$dir2" ] && (
        echo "Processing $basedir/$dir/$dir2..."
        find "$basedir/$dir/$dir2/" -type f -mtime +30 -delete
When migration from Cpanel to ISPconfig I found that my users have a lot of old mails in the trash. When I ran this script it saved me about 25GB of diskspace.
Michael Burgos
Reply With Quote
Sponsored Links