in reply to Recursive Directory print
If you want to print also the directories, you might change the relevant lines to this:use strict; use warnings; search_dir (shift); sub search_dir { my $path = shift; my @dir_entries = glob("$path/*"); foreach my $entry (@dir_entries) { print $entry, "\n" if -f $entry; search_dir($entry) if -d $entry; } }
print "$entry is a file \n" if -f $entry; print "$entry is a dir \n" and search_dir($entry) if -d $entry +;
|
---|