#!/usr/bin/perl
# generate pretty index.html from directory of .dsks
# AAW 4/5/10
$dirtoget=$ARGV[0];
opendir(DSKD, $dirtoget) || die("Cannot open directory");
@dsks=readdir(DSKD);
&header;
print "
";
print "";
foreach $dsk (sort @dsks)
{
if ($dsk =~ m/.*\.dsk$/)
{
@os9id = `os9 id $dirtoget/$dsk`;
foreach $line (@os9id)
{
if ($line =~ m/Disk\sname\s+:\s+(.*)/)
{
$name = $1;
}
elsif ($line =~ m/Disk\sformat\s+:.*\((.*)\)/)
{
$format = $1;
}
elsif ($line =~ m/Creation\sdate\s+:\s+(.*)/)
{
$created = $1;
}
elsif ($line =~ m/Total\ssectors\s+:\s+(.*)/)
{
$sectors = $1;
}
}
if ($dsk =~ m/_dw3[\._]/)
{
$format = "DriveWire 3/4";
}
$size = -s "$dirtoget/$dsk";
$size = int($size / 1024) . "k";
print "";
print "$dsk | ";
print "$name | ";
print "$size | ";
print "$created | ";
print "$sectors | ";
print "$format | ";
print "
\r\n";
}
}
print "
";
&footer;
closedir(DSKD);
sub header
{
print "Latest disk images";
print '";
print "";
print "NitrOS-9: Latest disk images
";
}
sub footer
{
print "";
}