in reply to Re^2: File types not being picked up by script
in thread File types not being picked up by script
added: I would read the example and explanation of the module File::Find carefully.use strict; use warnings; use File::Find; my $starting_dir = "put path to dir here"; my $count_dat_png = 0; find(\&wanted, $starting_dir); print "number of dat and png files: $count_dat_png\n"; sub wanted { return if -d ; # skip directories # . and .. are directories # or just leave this out entirely if (-f and ( /\.dat$/i or /\.png$/i)) { #print "$File::Find::name\n"; #full name if you want $count_dat_png++; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: File types not being picked up by script
by MShoaib (Initiate) on Jul 07, 2025 at 22:03 UTC |