[Dovecot] Fileoperations in Maildir – problematic or okay?

Steffen Kaiser skdovecot at smail.inf.fh-brs.de
Mon Aug 5 11:26:00 EEST 2013


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Mon, 5 Aug 2013, Martin Burgraf wrote:

> I'm wondering: Is it a problem to move and delete files inside a dovecot-managed maildir?
>
> For example:
> I have a folder ~/.maildir/.Sub1.Start/cur and a folder ~/.maildir/.Sub1.Start.old/cur
> and like to regularly move old mails from the first to the second one.
> Can you create a cron job saying something like:
> find ~/.maildir/.Sub1.Start/cur -mtime +5 -exec mv {} ~/.maildir/.Sub1.Start.old/cur \;
> ?
>
> I guess this would be some sort of problem, wouldn't it?

No problem with it basically, if both directories are located at the same 
parition (under the same mountpoint), in order to use the "rename()" 
syscall. Dovecot (and Maildir spec) expects the permissions a.s.o. in 
place when a file is seen in a folder new or cur. Also mtime should not 
change.

If you use keywords (labels, ...) they should be present in both folders, 
though. Look at the dovecot-keywords files, in it all relevant keywords 
must map to the same letter / digit. That also means: You cannot have more 
than 36 keywords per mailbox, because the others are storred in the index 
files only.

I use something like this:

find ..... -print0 | xargs -r0 mv -t target-dir

Regards,

- -- 
Steffen Kaiser
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iQEVAwUBUf9hmF3r2wJMiz2NAQJR1gf+Pso1E//le1G+HiTbLWBCF3VZ8zl/bGNy
xENVV85KjOT5N8MlV1OWCc+yw8ARXd3uywEaTvrt6QRag/DFMWX/+HxrypAZLIz9
Ap2MCDmCzNBD313DTBjvMliiMhg03ULcBpKlPS5O1sS0zK/Wibrx9EufsLIyfVyn
4l7DM1+jUznkTdcCY3uOffikz/qEB0pJa6uF6QkeegciBFDN69WEmTTni/PaMMYq
BCR41rEBf9VGzRlleQjvI4yni9ss4uaU7NUKxUQhcAvAjk3w4yIyRkDm8xh0j+cW
lbQvnd2f9pO6GUWb51+rYg5rSkSA1zaudOEVq6xUfyiHQ9kJoTPVhg==
=OAy1
-----END PGP SIGNATURE-----


More information about the dovecot mailing list