First off, I assume you're on a *nix machine. But figured I should state that in advance.
One problem you are facing is the file comes into existence, but isn't quite all there yet. I've seen this handled two ways 1) create the payload file in another location and then use a local system move to put it in the monitor directory and 2) move the payload file then move a trigger file (zero byte file) to the monitor directory.
Neither of these techniques are perfect, but they might be good enough
Another option might be to use something like dnotify or it's ilk to tell you when the file has arrived. Although these will depend on your os.
I've tried to use an os dependent directory monitor, however, I ran into problems when the monitor directory went from a local disk to an NFS mount. That's a much harder problem to solve.
Just some thoughts
Hazah! I'm Employed!
In reply to Re: select, stat, and waiting for files
by osunderdog
in thread select, stat, and waiting for files
by oakbox
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |