------------------------------------------------------------ #!/usr/bin/perl -w use CGI::Carp qw(fatalsToBrowser); $viewdirpath = "/home/your_site_id/www/folder_chosen_to_view"; $viewdirpath_only = "http://www.your_url.com/folder_chosen_to_view"; $script = "http://www.your_url.com/folder_chosen/viewdir.cgi"; print "Content-type: text/html\n\n"; &view_dir; sub view_dir { opendir DIR, "$viewdirpath"; @$_ = readdir DIR; closedir DIR; $count = 0; foreach $_ ( sort @$_ ) { $fitem_pathname = "$viewdirpath" . "/" . "$_"; if (-e $fitem_pathname && -d $fitem_pathname) { unless ($_ eq ".." || $_ eq ".") {$count++;}}} print ""; print "Folders Listed In Directory - $count
"; print "
"; print "sort by
"; print ""; print "
"; foreach $_ ( sort @$_ ) { $fitem_pathname = "$viewdirpath" . "/" . "$_"; if (-e $fitem_pathname && -d $fitem_pathname) { unless ($_ eq ".." || $_ eq "." || $_ eq "admin") { if($_ =~ m/^$FORM{'sortbyform'}/i) { print "
$_";}}} } } ------------------------------------------------------------