#!/usr/local/bin/perl # Update the IVM HTML documents to reflect the current images setpriority(0,0,getpriority(0,0)+6); # nice the process ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime; $year+=1900; ++$yday; ++$mon; if (length($mon) < 2) {$mon = "0".$mon;} if (length($mday) < 2) {$mday = "0".$mday;} if (length($hour) < 2) {$hour = "0".$hour;} if (length($min) < 2) {$min = "0".$min;} if (length($sec) < 2) {$sec = "0".$sec;} $now = "
$year-$mon-$mday $hour:$min:$sec UT"; if (@ARGV < 1) {die "Please specify a directory @ARGV ... dies at";} $RootPath = "$ENV{'WEB_ROOT'}/IVM/".$ARGV[0]; $WWWRoot = "/IVM/".$ARGV[0]; if (! -d "$RootPath") {print STDERR "$RootPath does not exist"; exit;} # directory exists? # Read directory opendir(GIFDIR,"$RootPath"); # Read directory @giffiles = grep(/(ivm\.gif)$/i,readdir(GIFDIR)); closedir(GIFDIR); if (@giffiles >= 1) { grep($_ = "$WWWRoot/".$_,@giffiles); # Add root to file names grep($_ = substr($_,0,length($_)-4),@giffiles); # Get rid of the .gif } # Sort the list of gif files by file name sub by_file_name { (reverse(split(m|/|,$a)))[0] cmp (reverse(split(m|/|,$b)))[0]; } @giffiles = sort by_file_name @giffiles; # Set HTML Header and Footer $html_header = <<"HEADER_END";
webmaster\@kukui.ifa.hawaii.edu
Last Update: $now FOOTER_END # Generate the HTML file print "$html_header\n"; if (@giffiles < 1) { # No gif files in the directory print "
$file_path[$#file_path] | \n";
if (++$column >= 3) {
$column = 0;
print "