in reply to how to permanently monitor a directory
Well, like all things Perl, TISMTOWTDI.
If you know what the files will be (example, they are uploaded by a script so the filename will always be the same) you could do something like:
If not, you could use your own code. I'm not sure I'd have it 'sleep' though. Run it from cron every so often would make more sense to me. Also, you can drop a couple of lines by changingwhile (1) { if (-e "/my/dir/filename.dat") { do_something_now(); } }
tomy $items_in_dir = @Dircontent; if ($items_in_dir > 2) ..
if (scalar(@Dircontent) > 2) ..
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: how to permanently monitor a directory
by LanceDeeply (Chaplain) on Aug 14, 2003 at 13:50 UTC |
In Section
Seekers of Perl Wisdom