oldenuf2no has asked for the wisdom of the Perl Monks concerning the following question:
To accomplish what I need I was trying to do this:{ find (sub {my $filename = $File::Find::name; if ( -f $filename ) { my $filetime = (stat "$filename")[9]; my ($sec, $min, $hour, $day, $month, $year) = (localtime($filetime +))[0,1,2,3,4,5]; if ($now - $fivedaystime > $filetime){ my $mm = $month+1; my $yy = $year+1900; open (LOGFILE, '>>', $script_auditlog) or die "Could not open fi +le '$script_auditlog' $!"; print LOGFILE "$filename last modified on $mm\/$day\/$yy $hour\: +$min\:$sec was removed.\n"; push (@file_list, $filename); } } }, $pslog_directory); close LOGFILE; }
Or I tried this:if ( -f $filename && $filename =~ /^Log*/ )
The files in the directory that is searched look like this:if ( -f $filename && $filename =~ /^L/ )
I need to leave the files that don't start with "L" alone. Any help is greatly appreciated.Log.txt.20151102 Log.txt.20151103 Fsvrcom1.trc Fsvrcom2.trc
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: File name search with regex
by NetWallah (Canon) on Dec 03, 2015 at 22:02 UTC | |
by oldenuf2no (Initiate) on Dec 08, 2015 at 15:27 UTC | |
|
Re: File name search with regex
by RichardK (Parson) on Dec 03, 2015 at 23:38 UTC | |
|
Re: File name search with regex
by stevieb (Canon) on Dec 04, 2015 at 00:11 UTC |