Welcome to the Monastery, angela2!
The following example will look into a directory specified by $dir, check whether the file name consists of only a series of digits, then adds the full path to @empty_files array, but only if the file is actually empty.
use strict; use warnings; my $dir = 'test'; opendir my $dir_handle, $dir or die $!; my @files = readdir $dir_handle; my @empty_files; for my $file (@files){ my $path = "$dir/$file"; next if -d $path; # skip if file is a directory if ($file =~ /^(\d+)$/){ next if ! -z $path; # skip if file is not empty push @empty_files, $path; } } for my $file (@empty_files){ print "$file\n"; }
In reply to Re: create array of empty files and then match filenames
by stevieb
in thread create array of empty files and then match filenames
by angela2
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |