At 14:21 2001-12-17 -0500, Dave Greco wrote:
I considered something like the following:
DATE=`date +"%Y/%m/%d"
:0:
$DATE
However, will Procmail take care of creating the directories automatically?
No.
If not, how can I implement this?
I suggest you consider reading the manpages. In particular:
'man procmailex'
Search for 'date' and consder if that example isn't nearly the same as
you're wanting to do here. You just need to roll it out into an extra
level to deal with the different dir levels (suggestion: it might prove a
lot easier to simply create a series of day folders automatically when
creating each month folder, which would relieve you of having to deal with
the subfolders).
This is a bit painful to run each time, but this might get you started
(please test it - I haven't):
# get the date, then the MONTH and YEAR folders (NOT by re-running date,
# since if we're on the cusp of a clock rollover, things would get hosed)
DAYFILE=`date +"%Y/%m/%d"
MONTHFOLDER=`echo "$DAYFILE" | sed -e 's/\([0-9]*\/[0-9]*\)\/[0-9]*/\1/'
YEARFOLDER=`echo "$DAYFILE" | sed -e 's/\([0-9]*\)\/[0-9]*\/[0-9]*/\1/'
:0
* ? test ! -d $YEARFOLDER
{
:0 Wic
| mkdir $YEARFOLDER
:0 Wic
* ? test ! -d $MONTHFOLDER
| mkdir $MONTHFOLDER
}
:0:
$DAYFILE
---
Sean B. Straw / Professional Software Engineering
Procmail disclaimer: <http://www.professional.org/procmail/disclaimer.html>
Please DO NOT carbon me on list replies. I'll get my copy from the list.
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail