Hello,
I have a lovely problem..
I have to monitor a set of files that live in a directory. I'd like to get
notified if one of those files gets deleted or disappears.
My system is a WinNt running perl 5.6 with the Win32::ChangeNotify. What
was cooked up is a simple routine that would check for writes/deletes to
files within a subdirectory.
What I'd like to do is to check for deletions of specific files. Consider
the following:
In a directory (c:\files\) I have 4-5 fiels, say File1.txt, File2.txt,
ect.. If File2.txt gets deleted I'd liek to know about it right away.
Here is the code:
#!c:/Perl/bin/perl.exe -w
use Win32::ChangeNotify;
my $Path = "c:/files/";
my $WatchSubTree = "1";
my $Events = "FILE_NAME";
my $notify = Win32::ChangeNotify->new($Path,$WatchSubTree,$Events);
until ($notify->reset)
{
$bMail = 1; # flag to trigger a sub to send a mail or something
}
else
{
$notify->wait; # keep on monitoring
}
Does ayone have a better way to monitor files?
Thanks for any light that can be shed on my feeble existence..
Keep Well,
Gonzalo
_______________________________________________
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web