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.
Thanks, NJ Sandever.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>
In reply to Re: Re: Re: Re: Create a list of directories without . and ..
by Anonymous Monk
in thread Create a list of directories without . and ..
by BrowserUk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |