in reply to Re: Directory Monitor
in thread Directory Monitor
Corion I have added short code , problem with event not email
#! usr/bin/perl use strict; use warnings; use File::Monitor; use File::Monitor::Delta; use File::Monitor::Object; my $path="/tmp/abc"; my $monitor = File::Monitor->new(); # Watch a directory $monitor->watch( { name => $path, recurse => 1 } ); # First scan just finds out about the monitored files. No changes # will be reported. $monitor->scan; # Later perform a scan and gather any changes while ($path) { my @changes = $monitor->scan; for my $file ( @changes ) { chomp($file); my @file_changes; my @file_list; if($file->is_event('size')){ print "size change\n\n"; } if ($file->is_size) { my $name = $file->name; my $old_size = $file->old_size; my $new_size = $file->new_size; print "$name has changed size from $old_size to $new_size\ +n"; } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Directory Monitor
by Corion (Patriarch) on Jul 25, 2016 at 11:00 UTC | |
by perlmad (Sexton) on Jul 25, 2016 at 11:28 UTC | |
by Corion (Patriarch) on Jul 25, 2016 at 11:32 UTC |