Hi:
I am not able to get the files at just the first level.
ie
 print "$_\n" for $io->all(0);  prints all level down
and
 print "$_\n" for $io->all(1); prints the files and the dir name at the
first level
ie
issuing the command for path C:\build\Sample\NewDir
prints the below
C:\build\Sample\NewDir\File1.txt
C:\build\Sample\NewDir\File2.txt
C:\build\Sample\NewDir\NewSubDirectory

In my case, I am not interested in the directory listing but only file
listing.

I didnt find anything in IO:All that would give me only file listing under a
particular directory without including the subdirectory listing.

Thanks, Nishi.


On 7/24/06, Dr.Ruud <[EMAIL PROTECTED]> wrote:

"Nishi Bhonsle" schreef:

> If I need to get the files without the "." and the ".." at the first
> level only, then how can i modify the find command?
> ie
> Currently using  find(sub {push(@new,$_) if ( -f ) }, $path); gives
> me all files under NewDir as well as NewSubDirectory
>  C:\build\Sample\NewDir\File1.txt
> C:\build\Sample\NewDir\File2.txt
> C:\build\Sample\NewDir\NewSubDirectory
> C:\build\Sample\NewDir\NewSubDirectory\11.txt
>  C:\build\Sample\NewDir\NewSubDirectory\12.txt
>
> If I need to get files only under NewDir and then issue another
> command to get files only under NewSubDirectory, then how can i
> restrict the find command to only look for the files under the
> directory mentioned

See `perldoc -f readdir`.

But I would use IO::All
http://search.cpan.org/search?module=IO::All

--
Affijn, Ruud

"Gewoon is een tijger."



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>



Reply via email to