Hello All, I have a chatroom and want to be able to archive the daily postings. The chat page resides within the Chat folder, as well as a page named archive.html. I would like to have the script write the date link to the archive.html page, copy the posts to that link, then clear the chatroom. Anyone aware of a script that will do this, or will my idea below work? Maybe a cleaner way to achieve this? Any suggestions appreciated. Thank you.
Dennis #!/usr/bin/perl # Use crontab to run this every night at 11:58pm or so @M = ("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep", "Oct","Nov","Dec") @tm = localtime(time); # Use to grab current date $thedate = sprintf("%4d%3s%2d", (1900 + $tm[5]) , $M[$tm[4]], $tm[3]); $thedate =~ s/ /0/g; # Turn 1-9 to 01-09 open(NEWARCH,">./messages/$thedate.txt"); open(CHAT,"<Chat1.html"); print NEWARCH <<ArchHeader; <HTML> <HEAD><TITLE>Archive for $thedate</TITLE> </HEAD> <BODY> <H4>Add whatever content you need as a header in the archive file</H4> ArchHeader while(<CHAT>) { # Print all lines to new file once we find --add here-- if (/--add here--/) { $printing_on = 1; } if ($printing_on) { print NEWARCH; } } close(NEWARCH); close(CHAT); # Save copy of archive.html rename "archive.html", "archive-old.html"; open(OLDA,"<archive-old.html"); open(NEWA,">archive.html"); while(<OLDA>) { # Print new archive file after the <tt> line if (/<tt>/) { print <<Newline; <a href="messages/$thedate.html">$thedate.html</a> Newline } print NEWA; } close(OLDA); close(NEWA); rename "Chat1.html","Chat1-old.html"; open(OLDC,"<Chat1-old.html"); open(NEWC,">Chat1.html"); while(<OLDC> && $leave_loop == 0) { print NEWC; # Leave loop after we find -add here- line if (/--add here--/) { $leave_loop = 1; } } close(OLDC); close(NEWC); " -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]