Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Show files on web page

Status
Not open for further replies.

evergrean100

Technical User
Joined
Dec 1, 2006
Messages
115
Location
US
On a Unix Web server I would like to print out files listed in a remote Windows server. The files need to be output on a web page. My attempt is not working and cant get the error messages because the web page says "Server Error Response (500)" after I try the below attempt.
Code:
print header, <<"EOF";
<HTML>
<BODY>
print("
my $name = $File::Find::name;
my $j = 0;
my $dir = '//anotherServer/directoryhere';

sub myNames
{
   $j++;
   print "$name/$_\n";
}

find( \&myNames, $dir);

print "No data found.\n", if $j == 0;
unless ($j == 0)
{
        print "FILE COUNT = $j\n";
}
");

</BODY>
</HTML>
EOF
 
Firstly, if you want to access files on a remote machine, you have to connect to that machine in some way (FTP, Samba, etc.): merely specifying //servername/dirname won't be enough. Perl will be looking for a file of that name on the local filesystem.

Secondly, by enclosing everything in a heredoc (i.e. between the <<"EOF" and EOF), your code would just be printed out, not executed. As-is it's just a string.
 
You should be aware that it's considered impolite to cross-post the same question to multiple forums without at least mentioning the fact that you've done so. People just end up waste time giving the same answers that have already been given elsewhere, as has happened in this instance. Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top