Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
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; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: File::Monitor Question
by Anonymous Monk on Jan 10, 2012 at 19:02 UTC | |
|
Re: File::Monitor Question
by i5513 (Pilgrim) on Jan 10, 2012 at 20:01 UTC | |
by Anonymous Monk on Jan 12, 2012 at 16:38 UTC | |
by Anonymous Monk on Nov 18, 2015 at 16:37 UTC |