Martin Burgraf
2013-Aug-05 07:36 UTC
[Dovecot] Fileoperations in Maildir – problematic or okay?
Hi, 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? IIRC dovecot keeps indexes of the files inside a folder and moving them around like this may confuse the software, am I right? bye Martin
Steffen Kaiser
2013-Aug-05 08:26 UTC
[Dovecot] Fileoperations in Maildir – problematic or okay?
-----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-----
Oli Schacher
2013-Aug-05 09:21 UTC
[Dovecot] Fileoperations in Maildir – problematic or okay?
On Mon, 5 Aug 2013 09:36:44 +0200 (CEST) "Martin Burgraf" <martin.bg at web.de> wrote:> find ~/.maildir/.Sub1.Start/cur -mtime +5 -exec mv {} > ~/.maildir/.Sub1.Start.old/cur \; ?instead of using find / mv you could use dovecot's 'doveadm' command to search/move/expunge messages see: http://wiki2.dovecot.org/Tools/Doveadm http://wiki2.dovecot.org/Tools/Doveadm/Move -- message transmitted on 100% recycled electrons