ftp automation

ScriptFTP

The professional tool to automate FTP, SFTP, FTPS and schedule FTP batch jobs

The forum is now read only. Please, go to the the main ScriptFTP website if you need help.
Need help writing a script? Have any question about ScriptFTP?
I wrote the following script to try and PRINT if a file transfer was successful, however, I'm not getting the "PRINT" to work.

I'm trying to use the "226 Transfer complete" (this is visible when Verbose logging is enabled).

I don't havfe to use the "226 Transfer complete option", but I'm not sure of how to do it another way.

Any help would be much apprecaited

My script is below:
FTP Script
  1. VERBOSE(ON)
  2. $date=GETDATE
  3.  
  4. #Create the log file name
  5. $logfile="C:\logs\transferlog-".$date.".txt"
  6.  
  7. LOGTO($logfile)
  8.  
  9.  
  10. # Connect to server and store the
  11. # return value of OPENHOST in $result
  12. $result=OPENHOST("ftp.www.beelerllc.com","beelerllccom","****")
  13.  
  14.  
  15. # If the result is "OK" transfer the
  16. # files and disconnect
  17. IF($result=="OK")
  18.          PRINT("CONNECTED")
  19.  
  20. $transresult= putfile ("random.txt")
  21.  
  22. # If the result is "226 Transfer complete"
  23. # Print on the screen "Transfer successful"
  24.  
  25. # ------- Edited by ScriptFTP support ------
  26. # The correct way to check if PUTFILE was correct
  27. # is to check if $transresult=="OK"
  28. # See posts below
  29. # -----------------------------------------------
  30. IF("$transresult"=="226 Transfer complete")
  31.     PRINT("File transfer, successful")
  32.  
Thanks but I found my own error - had a type-o.

Just to mention - this software is awesome!

Super easy to use.
Hi there,

The user contacted me by email. Here is my reply:

The correct way to check if PUTFILE was successful is this:
FTP Script
  1. IF($transresult=="OK")
  2.     PRINT("file successfully uploaded")