I'm trying to use the following, in order to be able to print the
names of sub-directories within a directory:

1       $folder = "/home/cwarnock/public_html/staged/DEVELOPMENT/"; 
2
3       opendir(DEV, $folder);
4
5       @all_files = readdir(DEV);
6
7       foreach $Name (@all_files) {
8               print  $Name;
9               if(-d $Name){
10                      print "$Name\n"; 
11                      }

I know that the directory has at least 4 sub-directories.

The 'print $Name;' on line 8, correctly prints all the sub-directory
and file names as well as '.' and '..'.
However, the 'print "$Name\n";' on line 10 (after the if statement)
only prints '.' and '..'. None of the other 4 directories are
printed.

I have also tried using 'if(-f $Name)' to see if files will be
printed but these do not appear to be being picked up.

Is there any explanation as to why this may be happening.

Thank you for your help.

Caroline Warnock

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to