just fyi,
I don't if anyone need to prune sent and drafts folders also
but based on Erik E's qtprune script I have modified a little bit
please check if found any mistakes

#!/bin/bash

# qtprune.sh
#
# This file can be put in /etc/cron.daily
# and will prune Trash/Spam directories
# Nov 7, 2006
#
# 3/5/2007 Added date configuration capability
#
# Erik A. Espinoza <[EMAIL PROTECTED]>
#
#
# 8/20/2007 Added pruning for Sent dan Draft folders
# PakOgah <[EMAIL PROTECTED]>
#
# Number of days for Trash
TRASH_DAYS="30"
# Number of days for Spam
SPAM_DAYS="30"
# Number of days for Sent
SENT_DAYS="90"
# Number of days for Drafts
DRAFTS_DAYS="90"

# Find Trash Dir
PATH_TRASH="`find /home/vpopmail/domains -type d -name .Trash`"
# Find Spam Dir
PATH_SPAM="`find /home/vpopmail/domains -type d -name .Spam`"
# Find Sent Dir
PATH_SENT="`find /home/vpopmail/domains -type d -name .Sent`"
# Find Drafts Dir
PATH_DRAFTS="`find /home/vpopmail/domains -type d -name .Drafts`"


# Exit if no spam or trash directories found
if [ -z "${PATH_TRASH}" ] && [ -z "${PATH_SPAM}" ] && [ -z "${PATH_SENT}" ] && [ -z "${PATH_DRAFTS}" ]; then
  exit 0
fi

# Delete Trash older than $TRASH_DAYS days
# if Trash directories found
if [ -n "${PATH_TRASH}" ]; then
  for each in "${PATH_TRASH}" ; do
      FILES_TO_DELETE="`find ${each} -type f -ctime +${TRASH_DAYS}`"
      if [ -n "${FILES_TO_DELETE}" ]; then
         for file in ${FILES_TO_DELETE} ; do
             if [ -n ${file} ]; then
                rm -f ${file}  >/dev/null 2>&1
             fi
         done
      fi
  done
fi

# Delete Sent older than $SENT_DAYS days
# if Sent directories found
if [ -n "${PATH_SENT}" ]; then
  for each in "${PATH_SENT}" ; do
      FILES_TO_DELETE="`find ${each} -type f -ctime +${SENT_DAYS}`"
      if [ -n "${FILES_TO_DELETE}" ]; then
         for file in ${FILES_TO_DELETE} ; do
             if [ -n ${file} ]; then
                rm -f ${file}  >/dev/null 2>&1
             fi
         done
      fi
  done
fi

# Delete Drafts older than $DRAFTS_DAYS days
# if Drafts directories found
if [ -n "${PATH_DRAFTS}" ]; then
  for each in "${PATH_DRAFTS}" ; do
      FILES_TO_DELETE="`find ${each} -type f -ctime +${DRAFTS_DAYS}`"
      if [ -n "${FILES_TO_DELETE}" ]; then
         for file in ${FILES_TO_DELETE} ; do
             if [ -n ${file} ]; then
                rm -f ${file}  >/dev/null 2>&1
             fi
         done
      fi
  done
fi

# Learn and Delete Spam older than $SPAM_DAYS
# days if Spam directories found
if [ -n "${PATH_SPAM}" ]; then
  for each in "${PATH_SPAM}" ; do
      FILES_TO_DELETE="`find ${each} -type f -ctime +${SPAM_DAYS}`"
      if [ -n "${FILES_TO_DELETE}" ]; then
         for file in ${FILES_TO_DELETE} ; do
             if [ -n ${file} ]; then
sudo -u vpopmail -H sa-learn --spam ${file} >/dev/null 2>&1
                rm -f ${file}  >/dev/null 2>&1
             fi
         done
      fi
  done
fi


exit 0
# EOF

PakOgah wrote:
http://wiki.qmailtoaster.com/index.php/Maintain_Trash_and_Spam_folder
http://devel.qmailtoaster.com/info/qtprune.sh

currently only maintain Trash and Spam folder
but I think you can edit them so sent and draft also can be maintained

Scripts to drain folders imap

List
Somebody has or knows some script to clean to the folders trash, sent,
draft
of the clients who enter by the webmail.


///////////////////////////////////////////////////////

Scripts para vaciar carpetas imap

Lista
Alguien tiene o conoce algun script para limpiar las carpetas trash ,
sent,
draft de los clientes que ingresan por el webmail.





---------------------------------------------------------------------
    QmailToaster hosted by: VR Hosted <http://www.vr.org>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to