in reply to usage of find::file and glob to filter out directories and retrieve selected files
Are you looking for files or directories? If you find the files you're looking for, there is no need to do any kind of filtering of directories
Shell commands
Shell sessionmd tmp3 md tmp3\a md tmp3\a\a md tmp3\a\b md tmp3\a\c md tmp3\a\d md tmp3\b\a md tmp3\b\b touch tmp3\a\b\f.pl touch tmp3\a\c\f.pl touch tmp3\b\b\f.pl findrule tmp3 -file ( *.pl ) perl -MFile::Find::Rule -le " print for File::Find::Rule-> file( q(*.p +l) )->in( q(tmp3) ); " perl -MFile::Glob=:glob -le " while(@ARGV){ print for glob shift } " " +tmp3/*pl" "tmp3/*/*pl" "tmp3/*/*/*pl"
I quoted "tmp3/*/*/*pl" because bash/csh/sh... will glob for you (cmd.exe doesn't).$ md tmp3 $ md tmp3\a $ md tmp3\a\a $ md tmp3\a\b $ md tmp3\a\c $ md tmp3\a\d $ md tmp3\b\a $ md tmp3\b\b $ touch tmp3\a\b\f.pl $ touch tmp3\a\c\f.pl $ touch tmp3\b\b\f.pl $ findrule tmp3 -file ( *.pl ) tmp3/a/b/f.pl tmp3/a/c/f.pl tmp3/b/b/f.pl $ perl -MFile::Find::Rule -le " print for File::Find::Rule-> file( q(* +.pl) )->in( q(tmp3) ); " tmp3/a/b/f.pl tmp3/a/c/f.pl tmp3/b/b/f.pl $ perl -MFile::Glob=:glob -le " while(@ARGV){ print for glob shift } " + "tmp3/*pl" "tmp3/*/*pl" "tmp3/*/*/*pl" tmp3/a/b/f.pl tmp3/a/c/f.pl tmp3/b/b/f.pl
findrule, File::Find::Rule, File::Glob
|
|---|