[Dovecot] Compressing existing maildirs

Jan-Frode Myklebust janfrode at tanso.net
Thu Dec 29 15:36:43 EET 2011


On Thu, Dec 29, 2011 at 02:55:40PM +0200, Timo Sirainen wrote:
> > 
> > I.e. find all maildir-files:
> > 
> > 	- with size in the name ("*,S=*")
> > 	- modified before I enabled zlib plugin
> 
> As long as it doesn't find any already compressed mails..

Can't I trust that no mails with timestamp before I enabled compression
are uncompressed? Or will dovecot compress old messages keeping old
timestamp when copying messages between folders, or something like that?

I want to avoid reading every file to check if it's compressed
already, as that will add ages to an already slow process..

> 
> > 	- compress them 
> > 	- add the Z suffix
> 
> Make sure there's also :2, suffix already. If someone hasn't logged in for a while there are such files in new/ directory.

So, 
	find /var/vmail -type f -name "*,S=*:2*" -mtime +6 -exec gzip -S Z -6 '{}' +


Right ? I don't care too much if I miss on a few percent of the files..


(I'll probably have to use "-newer /somefile" instead of -mtime since it
will run for some days)


  -jf



More information about the dovecot mailing list