procmail
[Top] [All Lists]

Re: directories

2006-02-02 01:13:43
On 01 Feb 2006, at 07:39 , Krzys wrote:
In a .procmailrc file is there any way to check for directory if it  
exists
and if it does create mbox in there as it would and if it doesnt then
either to create it (new directory) or just do something else?

Here's what I use (after long discussion on this list).


    :0: $HOME/lock
    $LISTNAME/$MYDATE.$LISTNAME

    # if the action failed, probably the directory does not
    # exist, so create it
    :0eW
    {
      LOG="FAILED WRITE $LISTNAME$NL"
      MAKENEWDIR=`test -d $MLDIR/$LISTNAME || mkdir -p $MLDIR/ 
$LISTNAME/`
    }

    # Now save the message again
    :0a:
    $MLDIR/$LISTNAME/$MYDATE.$LISTNAME

    # If we get this far, something is quite wrong.
    # Still failed?  Better save the message somewhere we can check it
    :0
    {
      LOG="FAILED WRITE NEW DIRECTORY$NL"
      :0: $HOME/lock
      $MLDIR/FAILED_LIST_SORT
    }

It's been working for years without ever hitting the FAILED_LIST_SORT  
mbox

-- 
Instant karma's gonna get you



____________________________________________________________
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

<Prev in Thread] Current Thread [Next in Thread>