procmail
[Top] [All Lists]

Re: Adding date to file name

1999-06-23 08:06:42
On Sat, 19 Jun 1999 02:53:15 -0700 (PDT), Larry Wright
<lwright(_at_)netcom(_dot_)com> wrote:
I get one message a day from a particular source. I'd like to send that
email message to a different directory as a separate file, with the file
name being the source, with the date appended in YYMMDD format (example:
from JSmith(_at_)hisadd(_dot_)com --> filename JSmith990612). I'd prefer the 
date to
be the date of the message, but the local machine date would be OK if
easier to do. How can I add the formatted date, within procmail, to make
the file name? 

Grab it out of the From_ line. See recent messages to the list about
this. I also updated the FAQ with an answer to this question. See
<http://www.iki.fi/era/procmail/mini-faq.html>

In a way, it's simpler to just use the same file all the time, and
then rename it to `date +name-%y%m%d` each night out of a cron job.

Extracting dates from the Date: header is an imprecise science at
best, because there are so many variants in use out there (some of
them grossly incompatible with anything at all, such as the month name
in Korean Hangul, without any clue how to decode it or even what
encoding they actually used). But if the messages always come from the
same source, it should certainly be doable.

In the near future, the info I need will be in an attachment
(possibly as octet coded text) rather than the msg text. Is there a
way to get the info from the coded attachment, and save it as a
text file with the date?

I don't understand this. But the simple and straightforward answer is
that if you can do it (in this case, extract the data you need from
the attachment) from the Unix prompt, you can do the same thing from
within Procmail.

/* era */

-- 
.obBotBait: It shouldn't even matter whether     <http://www.iki.fi/era/>
I am a resident of the state of Washington. <http://members.xoom.com/procmail/>
 * Sign the European spam petition! <http://www.politik-digital.de/spam/en/> *

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