I have a dir and sub-dirs underneath it.Inside subdirs, i have files with extension
*.mat( and may be some other dirs).
I am performing a recursive fn.
sub readFiles {
my $ipath = $_[0];
my $afile;
opendir(sDir, $ipath) || die "unable to open sDir: $!";
my @files = grep { /\.mat$/ } readdir(sDir);
foreach (@files){
print FILE "$ipath\\$_"."\n";
}
closedir(sDir);
}
But I need to say, based on a dir (argument to readFiles), check if there is any other dir, if so readFiles again.
My question is, what is the command in perl that "checks if there is a directory in a given path). Thanks.