Subject: Re: Save mail as unique filename

From: [email-masked] (David W. Tamkin)
Date: Tue, 17 May 1994 18:33:50 -0500 (CDT)

Bosco Tsang wrote,

| My forward post script require each mail to
| be in unique file. I am wondering how can I use procmail to save each
| mail using unique filename, like GEOG001, GEOG002, etc.? The script will
| post and clean the directory every twenty minutes. How can I reset the
| counter after that? Thanks.

Saving to a directory does exactly that: it puts each message into its
own file.

If you use an MH-style directory, the files will be named 1, 2, 3, etc.,
and after your cron job empties it out they should start over from 1
again, which seems to be what you want.

One caution: use a static name for the local lockfile for the recipe that
saves messages to that directory (the default will be the name of the file +
".lock" and will change with each filename inside the directory, I imagine:
normally one doesn't use local lockfiles on recipes that save to a directory
because there is no risk of mixed text); then use the lockfile program to use
the same lockfile name in the clean-out script.  That way no files will be
created while the clean-out script is running and the clean-out script won't
remove files from the directory while procmail is saving a message there.

David W. Tamkin  P. O. Box 3284  Skokie IL  60076-6284
[email-masked]   MCI Mail: 426-1818   +1 312 714 5610