use strict; use File::Path; use File::Find; my $dir="/home/testing"; my @dir = ($dir); my @srcfiles; find(\&srcfind, @dir); find(\&srcfind, @dir); sub srcfind { my $file = $File::Find::name; if ( -f $file && $file =~ /\.Z$/ || $file =~ /\.zip$/ || $file =~ / +\.tar$/ ){ push (@srcfiles, $file); } } if(@srcfiles){ print "There are some files\n"; }else{ print "There are no files \n"; }
In reply to FindFiles error in condition by mantra2006
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |