in reply to Reading entire subfolder tree into an array
Then you could do:my $dir = '/home/user1'; my @files = glob("$dir/*"); # Get list of files my @directories = grep { -d } @files; # Use -d to get dirs
...and of course repeat the process until a directory contains no more directories. Probably an easier way of traversing a directory structure is using the File::Find module though it does have some very irritating behaviours... It's a "standard" Perl module, and it should be on your system already.foreach my $directory (@directories) { my @list = glob("$directory/*"); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Reading entire subfolder tree into an array
by Aristotle (Chancellor) on May 28, 2002 at 17:23 UTC | |
by sdyates (Scribe) on May 28, 2002 at 19:38 UTC | |
by Aristotle (Chancellor) on May 28, 2002 at 19:41 UTC | |
by weini (Friar) on May 29, 2002 at 06:03 UTC |