Check out files in directory

  • Thread starter Thread starter Steph
  • Start date Start date
S

Steph

Hi,

Users send files via FTP in a specific directory on our server.
I need to create a program that checks out the arrival of a file (24/24,
7/7...) in the directory and then that performs some manipulations with this
file.
But, i need the file to be completely transfered before manipulating it.
What is the best way to wait the transfer to be completed ?

Thanks.
 
We create a second control file on the FTP directory once the first
file is completely transferred.
 
I'm no expert on FTP, but probably the simplest way is to check to see if
the filesize remains steady for a certain time period before concluding that
it's complete.
This is not foolproof however.
Alternatively, IF you can count on users sending a checksum file (or
something similar) along with the actual file, then you can use that to
verify that the file is complete.
 
Thanks, but i don't understand, what do you mean by "create a second control
file on the FTP directory" ? How do you do that ?
 
For example, mydata.dat is the file being transferred. You need to know
when that file has been completely transferred so you can start
manipulating it. One mydata.dat has been transferred then have the
sending process send a mydata.dat.control file. Your application can
then just wait for *.control files to arrive.

This is of course making the assumption that you have some control over
the sending side of things?

You could put a checksum (and/or expected file size) in the control
file as mentioned on the other post - but it's a redundant as FTP
should be checksummed anyway.
 
Back
Top