#[snip]# # Finally, remove old spreadsheets from temporary directory opendir(TMPD, $tmpdir) or die "No tmp Directory! $! \n"; while (my $f = readdir(TMPD)) { if ($f =~ /\.xls$/) { if ((-A "$tmpdir/$f") > 0.125) # if file is older than 3 hours, delete it { system('rm', '-f', "$tmpdir/$f") && die "Can't remove $f: $!\n"; } } } closedir(TMPD); #[snip]#