Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
This chunk of code, using READDIR, nicely reads in the
contents of the top level the directory, places it into
an array then prints it back out. However, READDIR on
Win32 ( and everywhere else I would assume) does NOT read
into the sub-directories. Just the top level. How does
one accomplish this?
#!/usr/bin/perl -w use strict; use FileHandle; my $localdir="c:\\temp"; opendir LOCALDIR, "$localdir"; my @local_files = grep !/^\.\.?$/, readdir LOCALDIR; closedir LOCALDIR; my $n=@local_files; for (my $i=0; $i<$n; $i++){ print "$local_files[$i]\n"; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Win32 Recursive Directory Listing
by tachyon (Chancellor) on Apr 09, 2002 at 20:53 UTC | |
Re: Win32 Recursive Directory Listing
by thelenm (Vicar) on Apr 09, 2002 at 20:03 UTC | |
Re: Win32 Recursive Directory Listing
by lucs (Sexton) on Apr 09, 2002 at 20:03 UTC | |
Re: Win32 Recursive Directory Listing
by silent11 (Vicar) on Apr 09, 2002 at 21:33 UTC | |
by VSarkiss (Monsignor) on Apr 09, 2002 at 23:14 UTC | |
by iakobski (Pilgrim) on Apr 10, 2002 at 12:36 UTC | |
by strat (Canon) on Apr 10, 2002 at 11:48 UTC | |
Re: Win32 Recursive Directory Listing
by BUU (Prior) on Apr 09, 2002 at 20:04 UTC |
Back to
Seekers of Perl Wisdom