use File::Monitor; use File::Copy::Recursive qw(fcopy rcopy dircopy fmove rmove dirmove); my $monitor = File::Monitor->new(); $files= 'c:\\PAPERS'; opendir(AA,$files) || return; my @list = readdir(AA); closedir (AA); foreach $file (@list) { $monitor->watch( $file ); } $monitor->callback( mtime => sub { my ($file, $event, $change) = @_; print "$file has been modified \n\n"; fcopy ("$file","p:\\phdpaper"); } ); while (1) { $monitor->scan; sleep 10; # After the first scan we get a list of File::Monitor::Delta objects # that describe any changes my @changes = $monitor->scan; for my $change (@changes) { # Call methods on File::Monitor::Delta to discover what changed if ($change->is_mtime) { my $name = $file_name; } } }