RE: problem with directory listing

2002-04-11 Thread Jason Larson

> -Original Message-
> From: richard noel fell [mailto:[EMAIL PROTECTED]]
> Subject: problem with directory listing
> 
> Below is sample code that does not work as I intend, the 
> intention being
> to list all the sub-directories in a given directory.
> 
> #!/usr/local/ActivePerl-5.6/bin/perl5.6.1 -w
> 
> use strict;
> my $mw;
> my $menubar;
> my $algebra;
> my @file_array;
> 
> my $dir_to_process = "/home/rfell/mathprogram";
> opendir DH, $dir_to_process or die "cannot open $dir_to_process: $!";
> foreach my $file (@file_array=readdir DH){
> if( -d $file){
> print "$file is a sub-directory of $dir_to_process \n";
> }
> }
> closedir DH;
> 
> The  problem is that only . and .. are listed. No other 
> sub-directories,
> which are in fact there, are listed. I surely am missing something
> simple here. Can anyone enlighten me?
> Thanks, 
> Dick Fell

I tested this on Win2k, ActiveState Perl 5.6.1, build 631, and had a similar
problem.  I did some further testing and got some interesting results.  Here
is what I found:

When run from c:\home\rfell\mathprogram, it showed all the directories.

When run from the root of C:\, it showed ., .., and the first subdirectory I
created.

When run from c:\home, it showed only . and .. as directories.

When run from a network drive, it showed only . and .. as directories.

All the subdirectories ARE listed in the array, but somehow the file test
descriptor is not being applied correctly or something.  I haven't looked on
ActiveState's site to see if this has been reported previously, but it seems
as though it definitely merits further investigation (or a better
explanation of why this is happening).

Hope this helps...
Jason


CONFIDENTIALITY NOTICE:



The information contained in this ELECTRONIC MAIL transmission
is confidential.  It may also be privileged work product or proprietary
information. This information is intended for the exclusive use of the
addressee(s).  If you are not the intended recipient, you are hereby
notified that any use, disclosure, dissemination, distribution [other
than to the addressee(s)], copying or taking of any action because
of this information is strictly prohibited.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: problem with directory listing

2002-04-11 Thread richard noel fell

John -
Thank you for your explanation. A stupid mistake on my part.
Dick Fell




John Edwards wrote:
> 
> Sorry. That should have been prepend.
> 
> -Original Message-
> From: John Edwards [mailto:[EMAIL PROTECTED]]
> Sent: 11 April 2002 12:47
> To: 'richard noel fell'; [EMAIL PROTECTED]
> Subject: RE: problem with directory listing
> 
> Whitespace, whitespace, whitespace. Right, got that over with now let's look
> at your code (formatted so it's readable)
> 
> #!/usr/local/ActivePerl-5.6/bin/perl5.6.1 -w
> 
> use strict;
> my $mw;
> my $menubar;
> my $algebra;
> my @file_array;
> 
> my $dir_to_process = "/home/rfell/mathprogram";
> 
> opendir DH, $dir_to_process or die "cannot open $dir_to_process: $!";
> 
> foreach my $file (@file_array=readdir DH) {
> if( -d "$dir_to_process/$file" ) { # You need to append the original
> directory to the file from readir here
> 
> 
> 
> --Confidentiality--.
> This E-mail is confidential.  It should not be read, copied, disclosed or
> used by any person other than the intended recipient.  Unauthorised use,
> disclosure or copying by whatever medium is strictly prohibited and may be
> unlawful.  If you have received this E-mail in error please contact the
> sender immediately and delete the E-mail from your system.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: problem with directory listing

2002-04-11 Thread John Edwards

Sorry. That should have been prepend.

-Original Message-
From: John Edwards [mailto:[EMAIL PROTECTED]] 
Sent: 11 April 2002 12:47
To: 'richard noel fell'; [EMAIL PROTECTED]
Subject: RE: problem with directory listing


Whitespace, whitespace, whitespace. Right, got that over with now let's look
at your code (formatted so it's readable)

#!/usr/local/ActivePerl-5.6/bin/perl5.6.1 -w

use strict;
my $mw;
my $menubar;
my $algebra;
my @file_array;

my $dir_to_process = "/home/rfell/mathprogram";

opendir DH, $dir_to_process or die "cannot open $dir_to_process: $!";

foreach my $file (@file_array=readdir DH) {
if( -d "$dir_to_process/$file" ) { # You need to append the original
directory to the file from readir here




--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: problem with directory listing

2002-04-11 Thread John Edwards

Whitespace, whitespace, whitespace. Right, got that over with now let's look
at your code (formatted so it's readable)

#!/usr/local/ActivePerl-5.6/bin/perl5.6.1 -w

use strict;
my $mw;
my $menubar;
my $algebra;
my @file_array;

my $dir_to_process = "/home/rfell/mathprogram";

opendir DH, $dir_to_process or die "cannot open $dir_to_process: $!";

foreach my $file (@file_array=readdir DH) {
if( -d "$dir_to_process/$file" ) { # You need to append the original
directory to the file from readir here
print "$file is a sub-directory of $dir_to_process \n";
}
}

closedir DH;

HTH

John

-Original Message-
From: richard noel fell [mailto:[EMAIL PROTECTED]] 
Sent: 11 April 2002 13:07
To: [EMAIL PROTECTED]
Subject: problem with directory listing


Below is sample code that does not work as I intend, the intention being to
list all the sub-directories in a given directory.

#!/usr/local/ActivePerl-5.6/bin/perl5.6.1 -w

use strict;
my $mw;
my $menubar;
my $algebra;
my @file_array;

my $dir_to_process = "/home/rfell/mathprogram";
opendir DH, $dir_to_process or die "cannot open $dir_to_process: $!";
foreach my $file (@file_array=readdir DH){ if( -d $file){ print "$file is a
sub-directory of $dir_to_process \n"; } } closedir DH;

The  problem is that only . and .. are listed. No other sub-directories,
which are in fact there, are listed. I surely am missing something simple
here. Can anyone enlighten me? Thanks, 
Dick Fell

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]