in reply to make infinite loop for live directory

One way to accomplish this is with a Perl module that will notify you when a directory changes.
Perhaps: File::Monitor?
There could be other modules for this.

You could keep a list of files that have been processed.
When a new file appears, process that new one.

Adjust your list of processed files as each new one comes in.
There can be some issues with this, please explain your application more.

  • Comment on Re: make infinite loop for live directory