http://qs321.pair.com?node_id=638293


in reply to File Watching in Windows

Well you are describing a "broken" interface (to call it something). You cannot guarantee the copy will be ok. Imagine the other side writes to the file in chunks of 10k every twenty minutes for ...

On the pragmatic side, the idea is simple, check the length of the file every x seconds, copy when it hasn't changed in the last n checks (y = n * x); choose n wisely ;)

Actually on my to_do list is to check File::Monitor; might be useful to you.

While writing this it occurs to me a variation: have the previous check of the size done by a child process, and have the child change the name to *.ok. In the main program just copy the *ok.

cheers --stephan