#!/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"; print "";