Re: archive by months and years

1999-11-04 09:22:47
It seems like every so often somebody asks a question like this.
Unfortunately the examples given on the Mhonarc web page are exceedingly
obscure. They seem to be pitched to people who have an advanced
understanding of Unix and inter-process communications. I have only been
working with Unix (Aix actually) and Perl for 5 years, but personally have
trouble understanding the examples. 

I am working with only partial success to create month-based archives using
a perl script. While the script does take care of the job of creating a new
subdirectory based on a date call, I am still having problems with the
actual results. Furthermore, the script does not address itself to date
anomalies which are crucial for proper archiving. My mailing list has some
messages that, for example, are dated Oct 31, but are filtered into the
November archive--only because they arrived after midnight, Nov. 1.

I am struggling with 2 different scripts. The first, depicted below, has
problems actually creating the "Otherindex", but does everything else okay.
The second is an attempt to interrogate the "Date: " line of the message in
order to filter it into the proper directory. Feedback would be most welcome.


$date = `date`;
@date_tbl = split(" ", $date);

$month = @date_tbl[1];
$year = @date_tbl[5];

$return = `ls /users/lnp3/public_html/archives`;
if ($return !~ /$month$year/)
  {`mkdir  /users/lnp3/public_html/archives/$month$year`;
   `chmod a+x /users/lnp3/public_html/archives/$month$year`;
   `cp /users/lnp3/public_html/archives/main.rc
   `cp /users/lnp3/public_html/archives/author.rc

`/usr/local/bin/mhonarc -add -rcfile
/users/lnp3/public_html/archives/$month$year/main.rc -outdir

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