boredcrazy
03-27-2001, 12:22 AM
I've written the following "Hello World" program to list all the
files in my main directory. But, when I run it, it shows that my folder is
empty when it's clearly not.
My account name is napkin. Is the path correct?
What am I doing wrong?
# # # # # # # # # # # # # # # # # # # # # # # #
#!/usr/bin/perl
#I'm assuming this is
#where I am on the server.
$PathToLiveFolder = "/home/napkin/public_html/";
#Open the main folder and split
#the file names into an array
opendir (WWW, $PathToLiveFolder);
@filenames = readdir (WWW);
closedir (WWW);
#Print HTTP_Header and intro line
print "Content-type: text/html\n\n";
print "All the files and folders should be listed here.<br>";
#Print out the name of each file in the array
$x = 0;
while($x < @filenames)
{
print "-".$filenames[$x]."<br>";
$x++;
}
#Display file count
print "<br>There were this many files:".@filenames;
files in my main directory. But, when I run it, it shows that my folder is
empty when it's clearly not.
My account name is napkin. Is the path correct?
What am I doing wrong?
# # # # # # # # # # # # # # # # # # # # # # # #
#!/usr/bin/perl
#I'm assuming this is
#where I am on the server.
$PathToLiveFolder = "/home/napkin/public_html/";
#Open the main folder and split
#the file names into an array
opendir (WWW, $PathToLiveFolder);
@filenames = readdir (WWW);
closedir (WWW);
#Print HTTP_Header and intro line
print "Content-type: text/html\n\n";
print "All the files and folders should be listed here.<br>";
#Print out the name of each file in the array
$x = 0;
while($x < @filenames)
{
print "-".$filenames[$x]."<br>";
$x++;
}
#Display file count
print "<br>There were this many files:".@filenames;