Does the following code using File::Find::Rule get you closer to what you want?
use warnings; use strict; use File::Find::Rule; my $dir = 'files'; my $type = '*.psd'; my @files = File::Find::Rule->file() ->name($type) ->in(($dir)); my $count = scalar @files; print "file count: $count\n\n"; print "file names:\n"; print "$_\n" for @files;
Output:
file count: 2 file names: files/a.psd files/subdir/b.psd
In reply to Re: trying to count files in a directory and subs
by stevieb
in thread trying to count files in a directory and subs
by flieckster
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |