my @files = `dir /B /S $root\\*.$ext`; foreach my $file (@files) { chomp $file; if (-M $file > $timelimit) unlink ($file); }