#!/usr/bin/perl -w
use strict;
use File::Find;
print "Content-Type: text/html\n\n";
print "
Web Server Directory Listing
";
my $dir_count = 0;
my $file_count= 0;
find(\&{ sub {
if (-d $_){ # File::Find puts us in the directory.
# We can stat, copy or rename
# without needing to know
# which directory we are in.
print $dir_count > 0?"\n":"";
print "Directory ",
++$dir_count,
": $_
\n \n" ;
# $File::Find::dir
# is the current directory
}
else{
print "- ",
++$file_count,
" $_
\n" ;
# $File::Find::name
# is the full path of the current file.
}
}
}, '/Intranet/html');
print "\n
";
print "";