in reply to trying to count files in a directory and subs
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: trying to count files in a directory and subs
by flieckster (Scribe) on May 19, 2016 at 21:09 UTC |