Help with script to list non-html files in folder
- From: "mac" <mac32bit@xxxxxxxxxxx>
- Date: 27 Oct 2005 14:00:03 -0700
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>";
}
.
- Follow-Ups:
- Re: Help with script to list non-html files in folder
- From: mac
- Re: Help with script to list non-html files in folder
- From: metaperl@xxxxxxxxx
- Re: Help with script to list non-html files in folder
- From: John W. Krahn
- Re: Help with script to list non-html files in folder
- Prev by Date: Re: File::Find Win32 Examples
- Next by Date: LWP::UserAgent POSTing creates 2 packets - I want just 1
- Previous by thread: Re: Newb Needs Help with Simple ImageMagick Module
- Next by thread: Re: Help with script to list non-html files in folder
- Index(es):
Relevant Pages
|
|