#!/usr/bin/perl -wT ##################################################### #####Web Site Directory Print ##### #####Copyright 2001, Jonathan Clover ##### ##### ##### #####Description: Program to Print out in plain ##### #####text tab-deliminated representation of a ##### #####directory structure. Has the ability to not##### #####include any directory, as well as allows ##### #####for a specific web directory to be ##### #####specified within the quiry string formated ##### #####like "?dir=/about". ##### ##################################################### use strict; use CGI; $CGI::DISABLE_UPLOADS = 1; $CGI::POST_MAX = 51_200; my ($web_dir, $default_dir, $tab, @non_include); #################### ###Configurations### #################### #Home Web Directory $web_dir = "/www2/nati"; #Default Directory to Start in if you #wish it not to be the Home Web Directory #$default_dir = "/www2/nati"; #Tab String to use for print out $tab = "\ \ \ \ "; #Files not to include #Those that start with . are never included #for obvious reasons(aka infinite recursion #and people trying to %#&@ with the script) #Regex accepted as values in list @non_include = ('_', #Front Page Hidden Folders 'Merchant2', #The Online Store Data Folder 'webstats'); #The Web Statstistics Folder ########################### ###End of Configurations### ########################### my $cur = CGI->new(); my $start; my $non_include = '^(\.|'.join('|', @non_include).')'; ###Allow for Param's from a web interface### if ( $cur->param("dir") ){ my ( $temp ) = ( $cur->param("dir") =~ /([\w\/]+)$/ ); $start = $web_dir.$temp; } else { $start = defined($default_dir)? $default_dir : $web_dir; } ###Calculate the number of tabs to be ###used when printing out results my @start = split('/', $start); my $tabs = $#start; ###Start the program and print out as plain text print "Content-Type: text/html\n\n", "\n", "\n", "
\n", "\t