I'm trying to perform an operation on every file in a directory.  I want to
skip directories.  I'm using the "-d" file test but it only catches "." and
"..".  Any ideas?
Here's the code (most of it out of the Cookbook):
my $dirname = "D:\\XYZ";

opendir(DIR, $dirname) or die "can't opendir $dirname: $!";

while (defined(my $file = readdir(DIR)))
{ 
    if (-d $file)
    {
        print "DIR: $file\n";
        next;
    }
    else 
    {

        # do something here

    }

}


____________________________________________
Steve Gross                          Tel:    (973) 586-8722  x249
IT Manager                           Fax:   (973) 586-0450
Fette America, Inc.
 

Reply via email to