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.
I am using ScriptFTP to allow me to FTP a file to a server so that it can be used for our website. The file is an access database that the website code can use to look up case history for one of our clients. The file isn't terribly big (190 MB). My problem seems to happen in random intervols. Usually the file is uploaded to the server with no problems, but for the last 2 nights, after the putfile is exicuted, the file is not renamed to the original name and file extention. Only the .part file is there. I have tried to modify the script but I would like some feedback before I make it live.
FTP Script
  1. #configure the port and pass username and password
  2. setprotocol(FTPS_EXPLICIT)
  3. setport(990)
  4. openhost("<server address>","<username>","<password>")
  5.  
  6. #Change directory to Dataread\BTA and place BTAWebAccessDB.mdb there
  7. chdir("Dataread\BTA")
  8.  
  9. # sets the label/point ':check'
  10. :check
  11.  
  12. putfile("C:\BTA\BTAWebAccessDB.mdb")
  13.  
  14. #See if the file was correctly transfered by making sure a '.PART' file does not exist.
  15. IF ("BTAWebAccessDB.mdb.part" = TRUE)
  16.    
  17.     #this will allow the putfile to start again if the .PART file DOES exist.
  18.         DELETEFILE("BTAWebAccessDB.mdb.part")
  19.     GOTO :check
  20.  
  21.     #Go up two directories to root (\) and then change the directory to Datawrite\appbta.
  22.     #put the file BTAWebAccessDB.mdb in the directory and change the name to
  23.     #BTA_Decision_db.mdb
  24.  
  25.    
  26.     chdir ("..")
  27.     chdir ("..")
  28.     chdir("Datawrite\appbta")
  29.  
  30.     :elsecheck
  31.  
  32.     putfile("C:\BTA\BTAWebAccessDB.mdb")
  33.     renamefile("BTAWebAccessDB.mdb", "BTA_Decision_db.mdb")
  34.  
  35.         #IF statement to check if the file was correctly transfered
  36.         IF ("BTAWebAccessDB.mdb.part" = TRUE)
  37.             GOTO :elsecheck
  38.         ELSE
  39.             CLOSEHOST
FTP Script
  1. #configure the port and pass username and password
  2. SETPROTOCOL(FTPS_EXPLICIT)
  3. SETPORT(990)
  4. OPENHOST("<server address>","<username>","<password>")
  5.  
  6. #Maximum number of retries
  7. $MaxRetries=5
  8.  
  9. #Change directory to Dataread\BTA and place BTAWebAccessDB.mdb there
  10. CHDIR("/Dataread/BTA")
  11.  
  12. $Cnt=0
  13. $Result=""
  14. WHILE(($Result!="OK") AND ($Cnt < $MaxRetries))
  15.   $Result=PUTFILE("C:\BTA\BTAWebAccessDB.mdb")
  16.   $Cnt=$Cnt+1
  17.  
  18. #Go up two directories to root (\) and then change the directory to Datawrite\appbta.
  19. #put the file BTAWebAccessDB.mdb in the directory and change the name to
  20. #BTA_Decision_db.mdb
  21.  
  22. CHDIR("/Datawrite/appbta")
  23.  
  24. $Cnt=0
  25. $Result=""
  26. WHILE(($Result!="OK") AND ($Cnt < $MaxRetries))
  27.   $Result=PUTFILE2("C:\BTA\BTAWebAccessDB.mdb", "BTA_Decision_db.mdb")
  28.   $Cnt=$Cnt+1
  29.