Question

My question is very similar to this one: What is the optimal way to monitor changes in a directory with a kqueue()? but I'm not satisfied with the answer there.

I have a kqueue setup to be notified when a file is copied to my app's Documents directory. Of course the notification fires as soon as the copying begins, but I want to know when it's completed. Surely there's a better way than polling modification times?

Was it helpful?

Solution 2

For now, the answer seems to be 'no', so I've resorted to polling the modification time of the file(s) in question.

If someone else is able to come up with a better answer, I'd be glad to hear it (and will un-accept this one).

OTHER TIPS

Do you initiate the copying and have control over the filenames ? Then the easiest solution could be to just copy to a temp file and then after that rename it to it's final name.that way you would know: if this file is there-it ist no longer written to.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top