I suppose a poor man's subsitute would be to just stat all the *.xml files, sleep for 10 (30?) seconds, stat them all again, and skip any where the filesize has changed. Not perfect, but probably works most of the time. Probably more reliable than just processing any file more than 2 seconds old.
Another thought...use the Linux inotify() api so that you can be more event oriented. See Linux::Inotify2. Then, every time a new file is created in the directory, you get an event. That would keep you from having to scan the directory. Though, it would increase the risk of processing a "in-use" file, so you'd need pretty good logic to determine when the file is done being written.
|Replies are listed 'Best First'.|
Re^5: Read, SFTP Put and Move Files from a "Busy" NFS FileSystem
by salva (Canon) on Jan 13, 2019 at 16:26 UTC
by kschwab (Vicar) on Jan 13, 2019 at 17:09 UTC