in reply to Appending date to filename for Archiving
foreach ( glob '*' ) { my $file_date = POSIX::strftime '%Y%m%d', localtime( ( stat )[ 9 ] + ); my $age = -M _; if ( $age >= 1 && $age < 2 ) { #rename Log File to .log.yyyymmdd rename $_, $_ . $file_date; } elsif ( $age > 14 ) { unlink $_; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Appending date to filename for Archiving
by viperl (Initiate) on Jun 29, 2009 at 13:38 UTC | |
by jwkrahn (Abbot) on Jun 29, 2009 at 14:46 UTC |