[Dovecot] Move to a Specific Folder
Is there a way to automatically expurge or move messages from a specific folder to another folder after "X" days?
Where "X" specifies the amount of days that messages in folder will be kept.
Thanks !
On Qui, 17 Set 2009, Darvin Denmian wrote:
Is there a way to automatically expurge or move messages from a specific folder to another folder after "X" days?
Where "X" specifies the amount of days that messages in folder will be kept.
If it's maildir, you can use find(1) to search the messages and mv(1)
them to another folder.
The next time the folders are opened dovecot will update the indexes.
-- Eduardo M KALINOWSKI eduardo@kalinowski.com.br
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.
If you can do this directly in Dovecot, then I guess that's better, because it will keep the folder indexes up to date. But I move messages around outside of Dovecot and it works fine. Dovecot updates the indexes when I view the folder, and there's not much delay.
A.
Will this solution works even if I had a lot of messages or subfolders? Will this index update take much time?
Thanks !
On Thu, Sep 17, 2009 at 2:36 PM, Andrew Schulman andrex@alumni.utexas.net wrote:
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.
If you can do this directly in Dovecot, then I guess that's better, because it will keep the folder indexes up to date. But I move messages around outside of Dovecot and it works fine. Dovecot updates the indexes when I view the folder, and there's not much delay.
A.
Will this solution works even if I had a lot of messages or subfolders?
Of course, if you know how to use the find(1) command. Test it carefully before you deploy it, though-- find | xargs rm is an extremely dangerous combination, since you'll probably need several iterations to get the find conditions right.
Will this index update take much time?
I can't say for sure. All I can say is that I've never noticed any significant delay. If you run the job daily, then index updates might be smaller and take less time. Even if Dovecot has to rebuild the whole index, you could probably arrange to make that happen right after you run your deletion job, at off hours. A search for "dovecot rebuild index" turns up some discussion of this problem.
Good luck, Andrew.
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.
Thanks, for all replies.
I'll use find :)
On Fri, Sep 18, 2009 at 11:06 AM, Andrew Schulman andrex@alumni.utexas.net wrote:
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.
On Sep 17, 2009, at 7:28 PM, Darvin Denmian wrote:
Is there a way to automatically expurge or move messages from a specific folder to another folder after "X" days?
Timo,
I know this plugin, but instead of removing the messages I need to move them to a specific folder,can it do this?
Thanks.
On Thu, Sep 17, 2009 at 4:11 PM, Timo Sirainen tss@iki.fi wrote:
On Sep 17, 2009, at 7:28 PM, Darvin Denmian wrote:
Is there a way to automatically expurge or move messages from a specific folder to another folder after "X" days?
Nope. Probably wouldn't be difficult to implement, but it's a pretty
low priority for me..
On Sep 17, 2009, at 9:30 PM, Darvin Denmian wrote:
Timo,
I know this plugin, but instead of removing the messages I need to move them to a specific folder,can it do this?
Thanks.
On Thu, Sep 17, 2009 at 4:11 PM, Timo Sirainen tss@iki.fi wrote:
On Sep 17, 2009, at 7:28 PM, Darvin Denmian wrote:
Is there a way to automatically expurge or move messages from a specific folder to another folder after "X" days?
participants (4)
-
Andrew Schulman
-
Darvin Denmian
-
Eduardo M KALINOWSKI
-
Timo Sirainen