[Dovecot] Move to a Specific Folder

Andrew Schulman andrex at alumni.utexas.net
Fri Sep 18 17:06:28 EEST 2009


> > Is there a way to automatically expurge or move messages from a
> > specific folder to another folder after "X" days?
> 
> I use a daily cron job for this.  It runs a script that deletes messages
> more than 6 months old from the Junk folder.

Looking at my nightly spam control job, I see that it essentially runs

find ~/.mail/.Junk/{new,cur} -type f -mtime +180 -delete

which deletes all files in the Junk folder that are more than 180 days old.
If instead of deleting those files you wanted to move them into another
directory, say $targetdir, then you could replace -delete in the above by
e.g. 

-exec mv --target-directory=$targetdir '{}' +

See find(1) for details.
A.



More information about the dovecot mailing list