I want to be able to process all files that follow the specific filenaming e.g. 2017_06_30_013901_0828900840_17062901D602BG So I want to process only files that contain *****************_0828900840_********D602BG with the help of the below code I was able to process all the files that have "D602BG". How can I achive my additional requirement within the same code.
foreach my $folder (@folders) { # glob the contents of the folder (to get the file names) my @contents = <$folder/*>; # For each filename in the list, if it matches foreach my $item ( @contents ) { if ($item =~ /C602DZB/){ #File name with specific +pattern open my $info, $item or die "Could not ope +n $item: $!"; while( my $line = <$info>) { if ($line =~ /Total/){ #Multiple pa +ttern match done push (@lines, $line); #Matching + lines pushed to an array } } } } }
In reply to Pick up specific file name by JobyJ
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |