Microsoft Access VBA Macro Programming

(Tina Sui) #1

If you use an automated process to transfer a large file onto an FTP server (possibly as an
overnight job), there may be a process on the FTP server polling once a minute to check for
your file.
You could also have the situation in reverse. You may have written a procedure to poll the
FTP server once a minute for a file that you wish to download. The problem in both cases is
how does the procedure know that the file is fully complete? If the procedure opens the
partially complete file, errors will occur.
In cases like this, semaphore files are used to indicate the completion of the file being
built. These are small text files of a few bytes in length, usually with the same name as the
file you wish to download, and with an SMP suffix.
The procedure that generates the file then generates the semaphore file when the transfer
file is complete. The transfer procedure polls the server for the semaphore file at minute
intervals instead of the real transfer file. When it finds the semaphore file, it is guaranteed
that the transfer file is complete and ready to be processed.


Chapter 36: Use FTP in VBA 341

Free download pdf