Because of the nature of maildir there are no locking issues. A find of the maildir tree looking from files with a ctime greater that your expire limit (please note that the command syntax of find is painful.) will generate a list of files to be removed. Remember that each message is its own individual file. Sending that list into xargs rm will actually remove the files.
<scw> e.g. cd /w/maildirs /bin/find . -type f -ctime +180 -print | /bin/xargs /bin/rm -f Will remove all messages read or unread that are older that 180 days. You probably don't want to do this. what you might want to do is find all the new mail older that a certian amount of time, This will in essence require a iterative tool (1) find all the new mail directories, then (2) find all the files in the new mail directories that are older than 180 days. This will require a script. Generation of this script is left as an exercise for the student (Knuth difficulity 12) <scw> On Wed, Jun 28, 2006 at 03:49:13PM +0100, Tariq Rashid wrote: > > hi - what is a sensible way of removing old mails on a system that holds > millions of users as a means of keeping storage requirements down. > > the use of quotas is fine as a cap on individual accounts ... but this is a > separate issue from removing old mail. > > a simple solution is to have a process that trawls the filesystem for old > mails and deletes it. this is fine but means that the activity on the sotrage > system is always non-zero and there may occasionally be locking issues when > users log in via imap/pop./webmail. > > another solution is to use events triggers such as when the user logs in/out > - but this is not useful for unused accounts which then accumulate unread > mail. also triggering around user actitivity means that the same mailbox is > beign competed for by two processes - the mail reader/writer and the cleaning > process. > > any thoughts - what are the lessons learned in the area...? > > tariq -- ----- Stephen C. Woods; UCLA SEASnet; 2567 Boelter hall; LA CA 90095; (310)-825-8614 Unless otherwise noted these statements are my own, Not those of the University of California. Internet mail:[EMAIL PROTECTED] Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Courier-imap mailing list [email protected] Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-imap
