sub finddir { my $root = shift; chomp ( $root ); $root = $root . '/' unless ( $root =~ m|/$| ); local *DIR; opendir ( DIR, $root ); while ( defined(my $file = readdir( DIR )) ) { next unless ( -d $root . $file ); next if ( $file eq '.' ); next if ( $file eq '..' ); print $root . $file, "\n"; finddir( $root . $file ); } }