hi, i'm attempting to open a parent directory that contains many sub directories and a few text and .pdf files. i want to test to see if the current file/dir is a directory before attempting to open it and test the filenames within it. i'm trying to use -d test but it doesn't seem to work and says that everything is not a dir when it is! i am accessing a network share.
thanks for any help! -adam sub numFilesInDir { # $dirpath path to Dir to test example: '\\\eggpayorteam\How To Test' my $dirpath = $_[0]; my $file; my $dir; my $counter = 0; opendir(DIR, $dirpath) or die "can't opendir $dirpath: $!"; while (defined($dir = readdir(DIR))) { unless ($dir eq '.' or $dir eq '..') { if (-d $dir) { print "true dir name: $dir\n"; ##### open this dir and check for number of files within it } else { print "false filez found: $dir\n"; } $counter++; } } closedir(DIR); return $counter; } ____________________________________________________ Start your day with Yahoo! - make it your home page http://www.yahoo.com/r/hs _______________________________________________ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs