[Dovecot] Moving Maildir email messages and backing things up.

mouss mouss at netoyen.net
Mon Apr 21 23:37:41 EEST 2008

Karl Schmidt wrote:
> mouss wrote:
>>> karl wrote:
>>> What would happen if I ran a script that did this:
>>> mv ~/Maildir/.folder_one/cur/* ~/Maildir/.folder_two/cur/
>>> My hunch is it might break things.
>> shouldn't break anything. if the MUA is caching "actions" (happens 
>> with thunderbird at least), then the view in the client will be 
>> different but this is not a big problem (at least for me).
> So on the server I could run something simple like:
> #!/bin/bash
> bogofilter  -Ns  -B /home/karl/Maildir/.s-2B-scaned_spam
> mv ~/Maildir/.s-2B-scaned_spam/cur/* ~/Maildir/.archived_spam/cur/

you'd better use an "axuiliary" directory:

mv $dir/.Junk.Trash/cur/* $dir/.Junk.Trash/todo/
$learn_spam $dir/.Junk.Trash/todo/  && mv $dir/.Junk.Trash/todo/* 

in short, first move the messages out of "imap" and then learn them.

check the right option for bogofilter so that it doesn't want the 
learned messages to stay in the same place.

> Afterwards the MUA 'view' of the folder might not be correct until 
> thunderbird re-caches the folder?

I just don't care since this is nothing more than a Junk folder!
> Is there a command line tool that would allow for moving emails that 
> would do it in a way that dovecot and the MUA would know to update 
> caches? 

the MUA will eventually "update" its view. so this is not really a problem.

> .,.,
> If I have two users share a mail folder, I would think the MUA 'view' 
> would also get behind. Is there a way to get thunderbird to re-cache a 
> folder?
> > but if it's for backup, why are you moving files?
> I'm looking into three separate issues: automating spam training, 
> backup issues, and sharing folders.

you'd better divide and conquer. you can find good solutions for each 
problem. if you try to find a single solution for all the problems, 
you'll have less choices and you run the risk to get it wrong.
> I really wish I could see a list of the ~/Maildir indexing files and 
> what they do - probably I don't need to know, but it might help me 
> understand what problems I might run into restoring a backup.

metoo:) but given that I could copy mail from courier to dovecot, I took 
it that I don't care much about the "administrative" files.

More information about the dovecot mailing list