[Dovecot] Automatic Folder Expiry (plugin?)

Sean Kamath kamath at geekoids.com
Fri Feb 2 06:24:55 UTC 2007


On Feb 1, 2007, at 9:58 AM, Troy Engel wrote:

> Mick T wrote:
>> I have around 5000 mailboxes on local SCSI drives, but yeah I nice  
>> -20  the script, and run early in the morning. It doesn't take too  
>> long to run
>
> Cool, thanks. (sorry about the Mike T instead of Mick T in the  
> other response, oops) I found that I get a nice speed boost by  
> using a bit more bash-fu with find's target, since my mailboxes are  
> NFS I want tailor to what I know we have. Since all mailboxes are / 
> home/X/XXXX/ (e.g. /home/t/tengel/) I am going with:
>
> find /home/*/*/ -regex '.*/Maildir/\.Junk/\(cur\|new\)/.*' -type f - 
> ctime +14 -exec rm -f '{}' \;

You'll probably have better luck with:

find /home/?/????/.*/Maildir/.Junk -regex '\(cur\|new\)/.*' -type f - 
ctime +14 -print | xargs rm -f

This will not work well with spaces in the paths. Switch back to - 
exec if so.  You might also run into limitations with find with 5000  
mailboxes.  Then I'd switch to

for i in /home/?/????/.*
do
	find $i/Maildir/.junk . . .
done

You can also background the find then, and run 'em in parallel.

> I ran a quick test using some ls -l action instead of rm to get a  
> speed test idea:
>
> # time find /home/*/*/ -regex '.*/Maildir/\.Junk/\(cur\|new\)/.*' - 
> type f -ctime +7 -exec ls -l '{}' \; > results.log
>
> real    23m15.837s
> user    0m54.882s
> sys     1m22.567s
>
> That'll do! Not the fastest, but it works. :)
> -te
>
> -- 
> Troy Engel | Systems Engineer
> Fluid, Inc | http://www.fluid.com



More information about the dovecot mailing list