Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Re: Re: Re: Create a list of directories without . and ..

by Anonymous Monk
on Jun 05, 2002 at 04:15 UTC ( [id://171719]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Re: Create a list of directories without . and ..
in thread Create a list of directories without . and ..

Hi. Still having trouble with this...I do not understand why calling "test.pl ." finds subdirs in the Products subdir if I run it there and pass "." as the arg but doesn't find them if I run it one level back (ie. CD ..)and pass "./Products" as the arg??

This is true which ever of the two filter clauses I use.

I hate being a "newbie" again.

C:\www\NB.biz\html>type test.pl #!/usr/bin/perl -w use strict; use diagnostics; print $ARGV[0], "\n"; opendir(DIR, $ARGV[0] ) or die ".: $!"; #my @list = grep { -d and /^\.\.?/ } readdir(DIR); my @list = grep { -d $_ and $_ ne '.' and $_ ne '..'} readdir(DIR); closedir(DIR); print foreach ( @list ), "\n"; C:\www\NB.biz\html>test.pl . . cssgraphicsProducts C:\www\NB.biz\html>test.pl ./products ./products <<<< NO OUTPUT HERE??? C:\www\NB.biz\html>test.pl ./Products/ ./Products/ <<<< OR HERE???? C:\www\NB.biz\html>cd products C:\www\NB.biz\html\Products>../test.pl . . Books C:\www\NB.biz\html\Products>
Thanks, NJ Sandever.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://171719]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2024-04-20 10:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found