[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Detecting EOF



Simon Buchanan <nmc@orcon.net.nz> writes:

> I am trying to detect that a file has stopped copying via FTP. As an
> example: User sending a file via FTP (100MB), cron job to test if the file
> has completed and then launch a command to do something with that file.

You could just keep checking the file size to see if it stops
increasing, but you probably don't want to run your process if the
FTP times out and the file is incomplete, and you don't want to
accidently trigger if it pauses too long.

I suggest the ftp file is ftp'd up with a temporary filename and then
renamed to the real file.  (FTP supports renames.)  Then, just watch
for the real filename.  Once it appears, you know that the transfer
has completed successfully.  (Conveniently, renames are
instantaneous, so you can't catch _that_ in the middle.)

-- 
Alan Shutko <ats@acm.org> - I am the rocks.



Reply to: