in reply to Directory available?
You can try following code (untested)
my $separator = ($^O eq 'MSWin') ? '\' : '/'; sub readFiles { my $ipath = shift; my @files; opendir(sDir, $ipath) || die "Unable to open directory '$ipath': $!"; for (readdir(sDir)) { if (!/^\.{1,2}$/ && -d $iPath . $separator . $_) { # recursive call for directory readFiles($iPath . $separator . $_); } else { # collect matching files push @files, $_ if /\.mat$/; } } closedir(sDir); for (@files){ print FILE $ipath, $separator, $_, "\n"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Directory available?
by kingjamesid (Acolyte) on Oct 24, 2009 at 23:56 UTC | |
|
Re^2: Directory available?
by afoken (Chancellor) on Oct 25, 2009 at 08:52 UTC |