From what I read the following should work, but it doesn't.
Can  one of you familiar with cygwin's perl help me out.

Why doesn't the test, -d, for directory work on the subdirectory?
It should, in my considered opinion.
Below is sufficient code to perform a simple test.

Your help is appreciated.

Regards,
 wynfield

prepare for the test from the command line:
$ mkdir /bozo
$ mkdir  /bozo/bozo_the_clown_dir

Check this:
find /bozo -type d -print
/bozo
/bozo/bozo_the_clown_dir
-- ok we have a directory and it has a subdirectory

Sample code:
------------------ start of simple perl program
#! /bin/perl

my $ldir="/bozo";

   if ( ! opendir DH, $ldir)
        {
        print "Couldn't open as a dir: $ldir. \n";
        exit 0;
        }

   print "Processing directory: $ldir\n";
   while ( $_ = readdir(DH) )      # will be either a file or directory name
       {
       if ( $_ eq "." or $_ eq ".." ) { print "dir . or ..\n"; next; }
       if ( -d $_ ) { print "This is directory: $_\n"; next; }
       print "Escaped detection $_\n";
        }

   close (DH);
---------------------------- end of sample code

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

Reply via email to