in reply to Finding files and subdirectories in a directory (was: A couple of ?'s)

You need to find out how many files & directories there are? Try this out:
opendir (THEDIR, $theDir) || die "Could not read $theDir - $!\n"; my ($filesFound, $dirsFound); for my $fileFound (readdir(THEDIR)) { next if ($fileFound eq '.' || $fileFound eq '..'); if (-d $fileFound) { # we found a directory... $dirsFound++; } else { # looks like it's a file... $filesFound++; } } if ($filesFound) { print "Found $filesFound files in $theDir.\n"; } else { print "No files were found in $theDir.\n"; } if ($dirsFound) { print "Found $dirsFound directories in $theDir.\n"; } else { print "No directories were found in $theDir.\n"; }
-- vek --