use strict;
dirTree("/tmp");
sub dirTree {
my $dirname=shift;
local(*DIR);
opendir(DIR, $dirname) || die "can not open $dirname ";
while ( my $entry=readdir(DIR)) {
my $path=$dirname . "/" . $entry;
next if ($entry =~ /^\./); #exclude anything start with .
if (-d $path) {
dirTree($path);
next;
}
doFile($path);
}
closedir(DIR);
}
sub doFile {
my $filepath=shift;
print "filepath: $filepath\n";
}
filepath: /tmp/amf.data filepath: /tmp/index.html filepath: /tmp/output.data filepath: /tmp/output.html filepath: /tmp/remotingMessage.data filepath: /tmp/req.data filepath: /tmp/tmp.txt