atom feed5 messages in net.sourceforge.lists.courier-imapRe: [Courier-imap] Read-only folders,...
FromSent OnAttachments
Jens MayerSep 14, 2005 3:44 am 
Brian CandlerSep 15, 2005 11:17 am 
Eduardo KienetzSep 16, 2005 12:50 pm 
Brian CandlerSep 17, 2005 1:03 am 
Eduardo KienetzSep 17, 2005 10:49 am 
Subject:Re: [Courier-imap] Read-only folders, automatic expunge
From:Brian Candler (B.Ca@pobox.com)
Date:Sep 17, 2005 1:03:02 am
List:net.sourceforge.lists.courier-imap

On Fri, Sep 16, 2005 at 04:50:52PM -0300, Eduardo Kienetz wrote:

Here's what I use (for reference):

cd /home/mydomain.com.br for DIR in $(ls) do if [ -d $DIR/Maildir/.Sent/cur ] ; then cd $DIR/Maildir/.Sent/cur find . -type f -mtime +60 -exec rm {} \; cd ../../../.. fi if [ -d $DIR/Maildir/.Trash/cur ] ; then cd $DIR/Maildir/.Trash/cur find . -type f -mtime +15 -exec rm {} \; cd ../../../.. fi done

Thanks for posting that.

A couple of hints: you may find that the "for .. in .." construct fails if ls returns a very large number of directories. You can avoid this problem by using

ls | while read DIR do ... done

Your script will also break if any directory name contains spaces, but that can be fixed by:

if [ -d "$DIR/Maildir/.Sent/cur" ]; then cd "$DIR/Maildir/.Sent/cur"

although personally I would write

find "$DIR/Maildir/.Sent/cur" -type f ....

and drop the cd pair.

Regards,

Brian.