in reply to Re: script for scanning folder and sending a warning if a file within it is older than 5 minutes
in thread script for scanning folder and sending a warning if a file within it is older than 5 minutes

Thanks L~R for the reply. The script only needs to create a single file (say in another local directory) with no contents...another program will be monitoring that directory for the existence of this file generated by the script. Something like "touch warning.txt" would work.
  • Comment on Re: Re: script for scanning folder and sending a warning if a file within it is older than 5 minutes

Replies are listed 'Best First'.
Re: 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 24, 2004 at 14:44 UTC
    For the sake of some closure, I have something unpretty that works:
    use strict; open OUTPUT, ">c:/temp/warning.txt"; my $mytime=(time); my ($File,$FileStat,$CallOutDir); chdir 'F:\Solimar_Work_Directories\XVTP\XVTP Cluster Feed' or die "Arg +hh!!! $!"; opendir(ROOT, ".") or die "Arghh!!! $!"; foreach $File (readdir(ROOT)) { next if $File=~/^\./; next if ($File eq "_Watched_Folder_._Active_"); next if ($File=~/\._Checking_File_Readiness_$/); next if (-d $File); if ($FileStat = (stat $File)[9]){ if ($FileStat <= ($mytime - 300)) { print "File older than 5min found. The file name is $File"; print OUTPUT "File older than 5min found. The file name is $Fi +le"; last; } } } close OUTPUT;
    I'm looking into adding some more functionality and flexibility to what's there. In the meantime it's doing what I need it to.