procmail
[Top] [All Lists]

Re: Muliple sub-folders archive

2001-12-18 00:13:43

<sigh>

On Mon, Dec 17, 2001 at 02:21:59PM -0500, Dave Greco wrote:

For all incoming messages, I want to filter them into folders based on the 
date. The folders should be a hierarchy like so:
...
2001/01/02
2001/02/01

Uh huh...

Naturally, I'd like to do this without just piping all messages into a Perl 
script that will take care of all of that. I considered something like the 
following:

DATE=`date +"%Y/%m/%d"

:0:
$DATE

Uh huh...

However, will Procmail take care of creating the directories automatically?
If not, how can I implement this?

You didn't read the FAQ *or* the list archives, did you?  No, you didn't.
Procmail processes mail.  Hence the name.  It does not install software,
wash dishes, create directories, or call for pizza.  It just processes
mail.  If you want to save messages in directories, those messages must
exist.  Your 'mkdir' command can make directories, but without knowing
your operating system, we can't advise as to how to do what you want.

On *my* system, which runs FreeBSD 4.4, I would probably:

        DATE=`date '+%Y/%m/%d'`

        :0 i:
        * DATE ?? \/.+[^0-9]
        * MATCH ?? \/.+[^/]
        * ? /bin/mkdir -p $MAILDIR/$MATCH
        $MAILDIR/$DATE

but if your mkdir can't -p you may have to get fancier.  `man install`
if your mkdir is feature-free.

-- 
  Paul Chvostek                                             
<paul(_at_)it(_dot_)ca>
  Operations / Development / Abuse / Whatever       vox: +1 416 598-0000
  IT Canada                                            http://www.it.ca/

_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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