Help with script to list non-html files in folder



Hi

I have this code but it does not seem to list non-html files.

Could anyone point me in the right direction.

Thanks in advance

Mark



#!/usr/bin/perl
print "Content-type: text/html\n\n";
# Define Variables
$basedir = '../';
$baseurl = 'http://www.mywebsite.co.uk/';
@files = (*.zip');
$title = "My Web Site";

# Get Files To Search Through
&get_files;

# Print Results of Search
&return_html;

sub get_files {

chdir($basedir);
foreach $file (@files) {
$ls = `ls $file`;
@ls = split(/\s+/,$ls);
foreach $temp_file (@ls) {
if (-d $file) {
$filename = "$file$temp_file";
if (-T $filename) {
push(@FILES,$filename);
}
}
elsif (-T $temp_file) {
push(@FILES,$temp_file);
}
}
}
}

sub return_html {
print "<html>\n";
print "<head>\n";
print "<title>Directory</title>\n";
print "</head>\n";
print "<body>\n";

print "Contents of folder:<p>\n";

foreach $FILE (@FILES) {
print "<a href=\"$baseurl$FILE\">$FILE</a></p>\n";
}

print "</body>";
print "\n</html>";

}

.



Relevant Pages