procmail
[Top] [All Lists]

Re: create nested maildirs as needed before creating a lock file?

2010-12-16 15:25:27
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Rich,

On 12/15/10 19:55, R.G. Ball wrote:

If you know the possible directory trees beforehand then just create them.


Actually a user is not allowed to login on the imap server to
create folders. It is already pretty painful to mount all the
users' home directories just to give procmail acess to the
.procmailrc files.

If you don't and the tree is going to be based on some information from
the message's header then extract that information into a variable and
test for the existence of the appropriate directory structure and create
it if necessary.

e.g. (untested):
:0
* ^Subject: \/FATAL.*
{
  DIRTREE=$LOGNAME/mailing_lists/$MATCH

 :0
 * ! ? test -d $DIRTREE || mkdir $DIRTREE
 {
#fail if couldn't create the needed
    EXITCODE=127
    HOST
 }

 :0
 $DIRTREE/
}


This is a pretty complex example, so I cannot claim that I
fully understand how it works, but I don't want dynamic
procmail rules. I didn't even know that this would be
possible.

All I am asking for is some code in procmail to create
missing nested maildirs before the lockfile is created.
AFAICS the current procmail can create flat maildirs, but
this seems to be broken for using lockfiles.

Of course I understand that constructs like '../../maildir/'
would require special care.


Many thanx, esp. for this interesting example

Harri
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk0Kg7QACgkQUTlbRTxpHjdPrACgitZSNtEwMDRSnEvg1Ev2fWdq
gqoAn2S+mrnsaY2R/nOxD7HaSMqrI2pE
=Y1lO
-----END PGP SIGNATURE-----
____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)de
http://mailman.rwth-aachen.de/mailman/listinfo/procmail