I have a question about the readdir() function in Perl. I am using readdir() to read out the contents of a specified directory:
opendir (PICKUPDIR, $dir); # $dir is the directory path
while ($contents=readdir(PICKUPDIR))
{
print <<END;
$contents<br>
END
}
Here is my question: Is there a way to specify that readdir ONLY read out the contents that are directories (not files). The code above prints out the files as well as the directories.
Any help would be appreciated.
opendir (PICKUPDIR, $dir); # $dir is the directory path
while ($contents=readdir(PICKUPDIR))
{
print <<END;
$contents<br>
END
}
Here is my question: Is there a way to specify that readdir ONLY read out the contents that are directories (not files). The code above prints out the files as well as the directories.
Any help would be appreciated.