#!/usr/bin/perl #################################################################################### # genindex.pl: # Reads the source directory and creates an index.html with the link # Author: Ram Viswanadha # #################################################################################### use File::Find; use File::Basename; use IO::File; use Cwd; use File::Copy; use Getopt::Long; use File::Path; use File::Copy; GetOptions( "--sourcedir=s" => \$sourceDir, "--destdir=s" => \$destDir, "--href=s" => \$href ); usage() unless defined $sourceDir; usage() unless defined $destDir; usage() unless defined $href; # create list of html files my @list; if (@ARGV) { @list = @ARGV; foreach (@list) { $_ .= ".html" unless (/\.html$/i); } } else { opendir(DIR,$sourceDir); @list = grep{/\.html$/} readdir(DIR); closedir(DIR); } $outfile = $destDir."/index.html"; $outFH = IO::File->new($outfile,"w") or die "could not open the file $outfile for writing: $! \n"; print $outFH "\n"; print $outFH "\t
Index of all comparison charts\n"; print $outFH "\t\n"; print $outFH "\t\t