Arcanum has asked for the wisdom of the Perl Monks concerning the following question:

I assume there is something obvious that I am missing here. I need to test files to see if they are directories, and using if (-d $file) never tests true. I am using ActivePerl 5.6.1 on a Windows 2000 machine. Is there something different I need to do in Windows to test for directories? Thanks.

Replies are listed 'Best First'.
Re: Test if a file is a directory in Windows
by runrig (Abbot) on Sep 18, 2001 at 02:42 UTC
    It should work. Are you perhaps only testing "$file" when you should be testing, e.g., "$path/$file" or do you first need to chdir to $path? Do you need to chomp your input?
      Thanks. I knew it would be something obvious. I didn't chomp anything. I'll try it when I get to work tomorrow. I'm sure that is the problem. Thanks again!