#!/usr/bin/perl
# th.pl

opendir(ROOT, "100");

open(OUT, ">100/index.html");
print OUT "<html><head><title>Index</title></head><body><table border=\"1\">\n";

$sfolder = '';
foreach $folder (readdir(ROOT)) {
    next if $folder=~/^\./;

    $sfolder = "100/$folder";
    opendir(DIR, $sfolder);
    print OUT "<tr><td><b>$folder</b></td></tr>";
    foreach $file (readdir(DIR)) {
        next if $file =~/^\./;
        next if $file =~/jpg/;
        next if $file =~/^Thumb/;
        $fname = $file;
        $fname =~s/\..*//;
        #print $fname, "\n";
        
        open(SFILE, "$sfolder/$file");
        @doc = <SFILE>;
        $tmpTitle = $doc[0];
        #print $tmpTitle, "\n";
        
        print OUT "<tr><td><a href=\"$folder/$file\">$tmpTitle</a><br></td></tr>\n";
        warn ".";
        close(SFILE);
    }
    close(DIR);
    print "\n";
}
print OUT "</table></body></html>";
close(OUT);