while ($file = readdir (DIR)) { if ($file !~ /^\.+$/) { # GET THE AGE OF THE FILE IN DAYS # -M gives us the age of the file in days when script started. # It needs to be rounded! $age = -M ($file); $age = sprintf ("%0.0f", $age); print "FILE: $file:\n\tAGE: $age\n"; if ($age > 2) { print "DELETE ME!\n"; } else { print "SAVE ME\n"; } } }