in reply to finding a subdir
use strict; use warnings; my @f = ('/perltest/folder/'); my ($folder, $file); do { $folder = shift @f; opendir(DIR, $folder); while ($file = readdir(DIR)) { next if $file =~ /\.$/; ### Skip . and .. if (-d "$folder$file") { print "$folder$file/ is a directory.\n"; push @f, "$folder$file/"; next; } print "$folder$file is a file.\n"; } } while ($#f != -1);
|
|---|