in reply to Find a particular directory in a directory

use strict; use warnings; my (@dirs, $find, $dir, $file); push @dirs, '/'; ### Assign starting directory $find = 'X'; ### Directory or file to find while ($dir = shift @dirs) { next if !opendir(DIR, $dir); while ($file = readdir(DIR)) { next if $file =~ /^\./; print "$dir\n" if $file eq $find; push @dirs, "$dir$file/" if -d "$dir$file"; } }