use File::Monitor; my $monitor = File::Monitor->new(); my $path="c:\\temp"; # Watch a directory $monitor->watch( { name => $path, recurse => 1, callback => { files_created => sub { my ($name, $event, $change) = @_; # Do stuff } } } ); # 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) { @new_files = $monitor->scan; for my $file ( @new_files ) { print $file->name, " created\n"; } sleep 1; }