On Feb 17, 2009, at 9:01 AM, Gustavo Vera wrote:

That program is the Finder, but could be any other program capable of writing files to disk. Those programs will be running in any other machine in the lan most of the time. I don't know if this is of any help, but my test case files vary in size from just 30 KB to 320 MB, and probably could be even bigger.

Thanks in advance!

This make things harder?


One approach could be to poll the file using fstat(2). If the st_mtime field is changing, you can assume that the file is still being written to. If it hasn't changed in some time period T, you can assume that the copy must have completed. The value of T is up to you and is dependent on your particular situation. If you pick a value that is too small, you run the risk of false positives.

Another approach may be to adapt lsof(8) to your needs. If the file has no open filehandles, then you can assume that it is no longer being copied. I suspect that performance may be poor if you're expecting to handle many files per second; if you're only handling a few files per minute, it might be okay.

--
Dave Carrigan
d...@rudedog.org
Seattle, WA, USA

Attachment: PGP.sig
Description: This is a digitally signed message part

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to