May be you actually want a "hotfolder".
On Linux (which i don't have anymore) there is File::Hotfolder.
Here is a sketch written in a hurry and not thoroughly tested for the Mac using Mac::FSEvents:
#!/usr/bin/env perl use strict; use warnings; use Data::Dump; use Mac::FSEvents; use IO::Select; use feature qw(say); my $dir = q(/Users/karl/Desktop/somewhere; my $fs = Mac::FSEvents->new( path => $dir, file_events => 1, ); my $fh = $fs->watch; my $select = IO::Select->new($fh); while ( $select->can_read ) { my @events = $fs->read_events; # dd \@events; for my $event (@events) { say $event->path; say for ( stat( $event->path ) )[ 7, 9 ]; } } __END__
With File::Hotfolder something similar should be possible.
Best regards, Karl
«The Crux of the Biscuit is the Apostrophe»
perl -MCrypt::CBC -E 'say Crypt::CBC->new(-key=>'kgb',-cipher=>"Blowfish")->decrypt_hex($ENV{KARL});'Help
In reply to Re: Monitor new file
by karlgoethebier
in thread Monitor new file
by colox
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |