#!/usr/local/bin/perl # 2592000 = 30 day n min (60 *60 * 24 *30 ) use strict; # change the below to dlt - my $dir = '/oven_web/iportal/cgi-bin/uploads'; 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 - 2592000)) { #print "Deleting $dir/$file..."; unlink("$dir/$file"); #print "Done.\n"; } }