in reply to The -d switch isn't working as I expected it to (test to see if its a directory)
there are shorter ways to write this but the basic idea is the same. find2perl is often useful to get a starting point for these as well.use strict; use File::Find; my $startdir = "/some/directory"; sub wanted { return if ($File::Find::name eq "." || $File::Find::name eq ".."); if(-d $File::Find::name) { print "DIRECTORY " . $File::Find::name , "\n"; } elsif(-f $File::Find::name) { print "FILE " . $File::Find::name . "\n"; } else { print "OTHER " . $File::Find::name . "\n"; } } File::Find::find({wanted => \&wanted}, $startdir);
|
|---|