[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: remove old trash from imap, server side



On 30/12/05, Daniel Webb <lists@danielwebb.us> wrote:
> On Thu, Dec 29, 2005 at 02:47:29PM +0800, Chris Purves wrote:
>
> > I am running courier IMAP using maildirs.  I would like to know what
> > is the best way for removing mail from the trash folder that are older
> > than six months.
> >
> > Is there any functionality built into courier or should I make a cron
> > job?  What are others doing?
>
> Not sure how to do it with Courier.
>
> Another possibility if you can shut down courier in the middle of the night
> is:
>
> % /etc/init.d/courier stop
> % cd Maildir && find . -type f -mtime +180 -exec rm \{\} \;
> % /etc/init.d/courier start
>

Thanks for your help.  I made a bash script using your suggestion that
removes old mail from specified directories:

#!/bin/bash

# this script purges mail older than specified days from specified
directories

# enter directory names to be purged, seperated by spaces
DIRS="trash sent-mail lists.clamav-announce"

# enter number of days to purge if older
DAYS="180"

for DIR in $DIRS
do
  find ~/Maildir/.$DIR/cur -mtime +$DAYS -exec rm {} \;
done

--
Take care, eh.
Chris



Reply to: