Reputation: 7483
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?
Upvotes: 2
Views: 522
Reputation: 7483
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).
Upvotes: 0
Reputation: 1813
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.
Upvotes: 1