#!/usr/bin/perl -w
# Script to create INDEX, HEADER and README files for met data from July 2000 ->
# Make links to 'comments' and 'readings' files
# hmm@arm.ac.uk April 2004
#
@months = ("01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12");
@monthnames = ("spacer", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
@shortmonthnames = ("spacer", "jan", "feb", "mar", "apr", "may", "jun" , "jul", "aug", "sep", "oct", "nov", "dec");
# Start with first full year
$year = 2001;
while ( $year < 2005 ) {
foreach $month (@months){
# Make HEADER file
$header = $year."/".$month."/"."HEADER.html";
print "$header\n";
open(HEADER, ">$header") or die "Can't open HEADER.html \n";
print HEADER < Site Contents | Main | Archives | Automatic Weather
Station | FAQ | Links | Contact Us Last Revised: 2004 April 21st
www contact: reception@armagh.ac.uk
Site Contents | Main | Archives | Automatic Weather
Station | FAQ | Links | Contact Us Last Revised: 2004 April 21st
END_OF_README
close README;
# Make INDEXA.html
$index = $year."/".$month."/"."INDEXA.html";
open(INDEXA, ">$index") or die "Can't open INDEXA.html \n";
# Make top of INDEXA.html file
print INDEXA <
www contact: reception@armagh.ac.uk
Site Contents | Main | Archives | Automatic Weather
Station | FAQ | Links | Contact Us Last Revised: 2004 April 21st
END_OF_INDEXA2
close INDEXA;
# Make COMMENTS.html file
# Make top of COMMENTS.html file
$comments = $year."/".$month."/"."COMMENTS.html";
open(COMMENTS, ">$comments") or die "Can't open COMMENTS.html \n";
print COMMENTS <
www contact: reception@armagh.ac.uk
END_OF_COMMENTS2
close COMMENTS;
# Make links for 'comments' and 'readings' files
$source = $year."/".$month."/"."am1".$month.$year."txt";
$target = $year."/".$month."/"."comments";
system("/bin/ln -f -s $source $target") == 0
or die "comments link failed: $?";
$source = $year."/".$month."/"."md_".$shortmonthnames[$month].$year."txt";
$target = $year."/".$month."/"."readings";
system("/bin/ln -f -s $source $target") == 0
or die "readings link failed: $?";
print "$month $year\n";
}
$year++
}