#!/usr/bin/perl use strict; use warnings; my $DirPath = "/tmp//testing"; while ("true") { opendir (DIR, "$DirPath") or die "Cannot open $DirPath $!\n"; my @Files = grep { !/^\.{1,2}$/ } readdir DIR; close DIR; if(scalar(@Files) > 1) { foreach my $File (@Files) { next unless (-f "$DirPath/$File"); chomp $File; print $File, "\n"; if ((-M "$DirPath/$File" > .0020)) { print "File: $File is older than 3 minutes\n"; } else { print "File: $File is not older than 3 minutes\n"; } } } else { print "Num of file required not met\n"; sleep 10; } }