|
|
|
|
|
|
Re: How to delete files from a folder, which is older then 10 days? [message #323690 is a reply to message #215766] |
Thu, 29 May 2008 04:36   |
anilalkg
Messages: 1 Registered: May 2008
|
Junior Member |
|
|
OR else you can use this perl script to have better control
********
my $dir = '/data/tmp/cvsbackup';
$dir='/export/home/tmp/akg'; # Remove later
opendir(DIR,$dir) || die "Can't open $dir : $!\n";
my @files = readdir(DIR); # you may want to grep only certain files here
close(DIR);
foreach my $file(@files)
{
my $now = time;
my @stat = stat("$dir/$file");
if ($stat[9] < ($now - 864000))
{
logMsg( "Deleting $dir/$file...");
#unlink("$dir/$file"); # Remove later
logMsg("Done.\n");
}
}
|
|
|
|