#! 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"; } } }