I have the following block of code:
With
(it's a full path, but I edited it here),
, and
, I get the following output:
Opening .../album...<br>
There are 1 files in the directory...<br>
.<br>
However, I know for a fact that the specified directory (777 BTW) actually contains "..", "DCP_O146.JPG", and "DCP_0147.JPG". So, the question is, why is this code not outputting the filenames which exist in that directory? Or more specifically, why is "readdir" only returning "."?
BTW, I get the same problem if I do "while (readdir DIR)..." instead of assigning it to an array.
Sincerely,
Tom Anderson
CEO, Order amid Chaos, Inc.
Code:
----------------------------------
my $string = "";
my $dir = "$self->{path}";
$dir .= "$folder" if $folder;
print qq~Opening $dir...<br>\n~ if $self->{debug};
opendir(DIR,"$dir")
|| return $self->error(200,"Cannot open directory $dir: $!");
my @files = readdir DIR
|| return $self->error(200,"Cannot read directory $dir:$!");
closedir DIR
|| return $self->error(200,"Cannot close directory $dir: $!");
print qq~There are ~. scalar @files .qq~ files in the directory...<br>\n~ if $self->{debug};
while (@files)
{
my $filename = shift @files;
$string .= qq~$filename<br>\n~;
}
print $string;
----------------------------------
Code:
$self->{path} = ".../album"
Code:
$folder = ""
Code:
$self->{debug} = 1
Opening .../album...<br>
There are 1 files in the directory...<br>
.<br>
However, I know for a fact that the specified directory (777 BTW) actually contains "..", "DCP_O146.JPG", and "DCP_0147.JPG". So, the question is, why is this code not outputting the filenames which exist in that directory? Or more specifically, why is "readdir" only returning "."?
BTW, I get the same problem if I do "while (readdir DIR)..." instead of assigning it to an array.
Sincerely,
Tom Anderson
CEO, Order amid Chaos, Inc.