On 5/2/07, Chris E. Rempola <[EMAIL PROTECTED]> wrote:
Hi All:

Can anyone give me some direction in writing a simple Perl script for
checking files in a particular directory thats older than 20 mins.  Is
there a module I can use to grab the current time-stamp of a file?
Thanks in advance....

-Chris

The -M test will tell you how old a file is in days relative to the
start of the script.  To get minutes you can multiply that value by
24*60


#!/usr/bin/perl

for my $file (<.* *>) {
       print "$file is ", int(24*60 * -M $file), " minutes old\n";
}

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to