use File::Copy::Recursive; use File::Find; use strict; my $srcdir='c:\\inetpub\\performancetesting\\output\\new\\'; my $destdir='c:\\'; File::Copy::Recursive::dircopy $srcdir, $destdir or die "Copy failed: $!"; use File::Monitor; my $monitor = File::Monitor->new(); # Just watch $monitor->watch('c:\\inetpub\\performancetesting\\output\\new\\mlx\\aar\\04-16-2009.txt'); # Watch with callback $monitor->watch('otherfile.txt', sub { my ($name, $event, $change) = @_; print "file has been changed"; # Do stuff; }); # Watch a directory $monitor->watch( { name => 'c:\\inetpub\\performancetesting\\output\\new\\mlx\\', recurse => 1, callback => { files_created => sub { my ($name, $event, $change) = @_; print "something modified in directory mlx"; } } } ); # First scan just finds out about the monitored files. No changes # will be reported. $object->scan; my $monitor->scan; # Later perform a scan and gather any changes my @changes = $object->scan;