in reply to script for scanning folder and sending a warning if a file within it is older than 5 minutes
Cheers - L~R#!/usr/bin/perl use strict; use warnings; my $dir = $ARGV[1] || 'C:/devl/bin'; chdir $dir or die "Unable to change directories to $dir : $!"; my $now = time; my $threshold = $ARGV[0] || 300; opendir( DIR , '.' ) or die "Unable to read $dir : $!\n"; for ( readdir( DIR ) ) { if ( abs( $now - (stat($_))[9] ) > $threshold ) { Create_Warning_File(); last; # Unless you want 1 warning per file } } sub Create_Warning_File { # You did not give enough information to fill this in }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: script for scanning folder and sending a warning if a file within it is older than 5 minutes
by dkaplowitz (Novice) on Mar 19, 2004 at 19:18 UTC | |
by dkaplowitz (Novice) on Mar 24, 2004 at 14:44 UTC |