FROM : Aaron Jacobs
DATE : Tue Aug 08 07:40:11 2006
The FTP protocol itself may not have such a concept, but it is
possible that the FTP daemon which is writing to the files may flag
them as such, no? Or the operating system, which realizes that they
are open for writing by the FTP daemon process?
A huge kludge would be to check the file size once and then again a
few seconds later, if that is feasible for your application, and see
if it has changed. But if you know in advance that they are going to
be JPEGs, you may as well just parse them. That will have the added
advantage of weeding out (some kinds of) corrupt files.
>> I have an application in which it monitors a particular folder for
>> new files and processes them. In one particular case, the files
>> are being sent to the folder via FTP - I'm checking to see if the
>> files are busy (NSFileBusy) before trying to read them, but in the
>> case of FTP, it says they aren't busy. Is there another way to
>> check for an incomplete file for the FTP case? These are actually
>> JPEG image files, so one option is to parse the headers, get the
>> image dimensions and compare to the file size - but I was hoping
>> there was an easier way to handle this. Thanks.
>
> FTP doesn't have any concept of "file in use". Parse away.
DATE : Tue Aug 08 07:40:11 2006
The FTP protocol itself may not have such a concept, but it is
possible that the FTP daemon which is writing to the files may flag
them as such, no? Or the operating system, which realizes that they
are open for writing by the FTP daemon process?
A huge kludge would be to check the file size once and then again a
few seconds later, if that is feasible for your application, and see
if it has changed. But if you know in advance that they are going to
be JPEGs, you may as well just parse them. That will have the added
advantage of weeding out (some kinds of) corrupt files.
>> I have an application in which it monitors a particular folder for
>> new files and processes them. In one particular case, the files
>> are being sent to the folder via FTP - I'm checking to see if the
>> files are busy (NSFileBusy) before trying to read them, but in the
>> case of FTP, it says they aren't busy. Is there another way to
>> check for an incomplete file for the FTP case? These are actually
>> JPEG image files, so one option is to parse the headers, get the
>> image dimensions and compare to the file size - but I was hoping
>> there was an easier way to handle this. Thanks.
>
> FTP doesn't have any concept of "file in use". Parse away.
| Related mails | Author | Date |
|---|---|---|
| Jeff Schindler | Aug 8, 05:32 | |
| Andrew Farmer | Aug 8, 07:34 | |
| Aaron Jacobs | Aug 8, 07:40 | |
| Chris Suter | Aug 8, 07:54 |






Cocoa mail archive

