Script

FTP

The professional tool to automate FTP, SFTP, FTPS

and schedule FTP batch jobs

MENU MENU
Post here if you experience file transfer problems or unexpected errors.
We are seeing instances where it looks like the ftp script is downloading partial files from the ftp. It kicks the script off every 3 minutes
It is getting a result of ok and deleting the file.

Have you seen this before or is there anything I can do to make sure it doesn''t download partial files?
FTP Script
  1. # For each file in $list...
  2. FOREACH $item IN $list
  3.     # Download the file
  4.     $result=GETFILE($item)
  5.     #Get the filesize of folder
  6.     $size=GETFILESIZE(REMOTE,$item)
  7.     PRINT("File Size for ".$item. ": ".$size)
  8.     # If the file has been succesfully downloaded
  9.     # delete the remote copy. If not stop the script.
  10.     IF($result=="OK")
  11.        DELETEFILE($item)
  12.        EXEC('xcopy "\\producer\Hires Graphics\AutoFTPDownload\ROP_Color\"'.$item.' "\\producer\Hires Graphics\CTP Broad Color\" /Y')
  13.     END IF
It kicks the script off every 3 minutes
It may happen that the file located in the FTP site (uploaded by other FTP client or copied there by other process) is not complete. If you run the script so often this will happen sooner or later.

Consider using lock files. Take a look at this forum topic:

http://www.scriptftp.com/forum/viewtopic.php?f=6&t=566