[Israel.pm] How to detect a new file in a directory without busy wait ?

Yossi Itzkovich Yossi.Itzkovich at ecitele.com
Thu Mar 27 11:50:35 EET 2008


Hi,

I have a script that should wait for a new file to be created, and then
start processing it. I don't know the filename, just the pattern (known
prefix).  I can do it  like this

While (1)
{
	get directory content
	check each file for filename pattern. If found - last.
	sleep for few 100ms
}

But I guess there is a more elegant way.  Is there ?


Yossi


More information about the Perl mailing list