#!/usr/bin/perl -w
use strict;
# Script to delete the files older than "N" days.
my $DIR='';
my $life=2;
# File format to be matched can be enhanced. formats are seperated by whitespace
foreach my $t (glob("$DIR*.pl_* $DIR*stc $DIR*tcl $DIR*topo"))
{
my $age =int(-M $t);
if($age > $life)
{
print "$t is " . $age . " days old. Hence deleting it...\n";
unlink $t;
}
}
No comments:
Post a Comment