Re: Notification of file system modification arrives too early?
Re: Notification of file system modification arrives too early?
- Subject: Re: Notification of file system modification arrives too early?
- From: Scott Ribe <email@hidden>
- Date: Fri, 28 May 2010 10:49:14 -0600
On May 28, 2010, at 7:57 AM, Antonio Nunes wrote:
> I expect many of the files will arrive in the watched folder either through user manipulation in the Finder or through scripts/automation. I don't think I can assume only Finder-originated copying.
Then there's no way for the system to know when the operation is "done". The file being closed would be a very good candidate, but not necessarily... Even more so, the file being open doesn't necessarily mean it's still being copied (Spotlight, for instance).
Generally the most reliable way to deal with this is requirements on the process putting the file in the folder. In other words do not copy, and most certainly do not download, a file to the final name/location from where it will be picked up. Copy (or download) to a temporary file, distinguished by name or extension or type or visibility or location, then when the file is complete rename/update/move.
If you're only dealing with PDF files, you could check for the presence of the PDF footer at the end of the file. That would work unless some process creates a complete PDF file, then appends pages to it.
--
Scott Ribe
email@hidden
http://www.elevated-dev.com/
(303) 722-0567 voice
_______________________________________________
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