Enter search queries below or use the tag links to the right to browse the knowledge base by category (Show All Tags).
I have a problem where occasionally the last file in a batch is still being written, and when it comes time to download it, it results in the reception of a partial file. Can I skip the last file in the batch or test its conditions to avoid this?
There is no way to directly prevent this if the FTP server allows access to an open file. It's really the server's responsibility to prevent something like this from happening.
With that being said, you can get around this by doing something differently in your script.
Use the GETSITEFILE to get information about the file in question. Among other things, the size of the file is saved in the %sitefilesize script variable.
You can loop on a particular file issuing the GETSITEFILE every second (or so) and look at the file size. If it is changing, you know that the file is still being written to. When the size stabilizes of a period of time (of your choosing), the script can probably safely assume that the file has been closed.
Version 3.9.7 and later
Starting with version 3.9.7 the RCVFILE command supports an option named /skip_changing that can be used to implement this behavior with one line of script. The SENDFILE command also supports this option for local files. Please see the Help file for details.
Article last updated: 2018-01-06
Tags: Download, Robo-FTP