How to determine if a file is completely copied?
How to determine if a file is completely copied?
- Subject: How to determine if a file is completely copied?
- From: Gustavo Vera <email@hidden>
- Date: Tue, 17 Feb 2009 14:25:49 -0200
Hi list,
I'm trying to get status info from a file on disk, to be more precise, I
need to know if the file is currently destination of a regular copy
operation. I'm currently working with NSFileManager to get a list of the
contents of a specific folder, and when I detect a new file on that folder,
I need to process it in certain ways, but before start doing that, I wanna
be sure that the file was completely transferred to that directory.
I'm currently trying to obtain some clues about the state of the file, using
using the following selectors,
fileAttributesAtPath:traverseLink:,
isReadableFileAtPath:,
isDeletableFileAtPath:, and
isWritableFileAtPath:
but none of this ones seems to responds differently either if the file as
been completely copied or not.
I also tried to rename the file when I detected, and the operation always
succeeds, even if the file was not fully copied (in this cases the copy
operation is aborted and the partially copied file seems to be lost).
I was thinking in use the file size as an indicator of a finished copy
operation (something like "if the file size didn't change in the last 10
seconds", or something like that)... but I still have hope in finding a
better or more elegant solution.
Any ideas?
Thanks in advance!
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden