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?
Hello,
I'm looking for a tool which can facilitate my daily work.
The task: I must pick files from an FTP server (5 image files) and upload it to 60 different FTP servers.
Can I create a script that does the job here? The IP addresses of the servers can be loaded from a text file. I am pleased to hear. The important thing is the status - I need to know which file transfer worked out and what not .- :)
Hello,

Thanks for posting here. One question. Having the IP addresses in a text file is a must or you can have then in the script file?

For example:
FTP Script
  1. $servers="192.168.0.2|192.168.0.3|192.168.0.4|192.168.0.5"
  2.  
  3. FOREACH $server IN $servers
  4.     OPENHOST($server,"myuser","123456")
  5.     PUTFILE("C:\My Documents\notes.txt")
  6.     LOCALCHDIR("C:\Users\Eli\Documents")
  7.     PUTFILE("sales1.xls")
  8.     PUTFILE("sales2.xls")
  9.     PUTFILE("sales3.xls")
  10.     PUTFILE("sales4.xls")
  11.     PUTFILE("sales5.xls")
  12.     CLOSEHOST
Hi,
that sounds good, but in your Code Example it must be:
FTP Script
  1. FOREACH $server IN $servers
  2.    OPENHOST("ftp.myhost.com","myuser","123456")
change into:
FTP Script
  1. FOREACH $server IN $servers
  2.    OPENHOST($server,"myuser","123456")
Ops. I have just changed it
I need to know which file transfer worked out and what not .- :)
You can do that checking the result of PUTFILE. For example, to create a text file that keeps the errors:
FTP Script
  1. $servers="192.168.0.2|192.168.0.3|192.168.0.4|192.168.0.5"
  2.  
  3. FOREACH $server IN $servers
  4.     OPENHOST($server,"myuser","123456")
  5.     PUTFILE("C:\My Documents\notes.txt")
  6.     LOCALCHDIR("C:\Users\Eli\Documents")
  7.     PUTFILE("sales1.xls")
  8.     IF($result!="OK")
  9.         LOGTO("C:\Users\Carlos\Dekstop\transfer_errors.txt")
  10.         PRINT(GETTIME(FORMAT1).": Error transferring sales1.xls to ".$server)
  11.         STOPLOG
  12.     END IF
  13.     PUTFILE("sales2.xls")
  14.     IF($result!="OK")
  15.         LOGTO("C:\Users\Carlos\Dekstop\transfer_errors.txt")
  16.         PRINT(GETTIME(FORMAT1).": Error transferring sales2.xls to ".$server)
  17.         STOPLOG
  18.     END IF
  19.  
  20.     PUTFILE("sales3.xls")
  21.     IF($result!="OK")
  22.         LOGTO("C:\Users\Carlos\Dekstop\transfer_errors.txt")
  23.         PRINT(GETTIME(FORMAT1).": Error transferring sales3.xls to ".$server)
  24.         STOPLOG
  25.     END IF
  26.  
  27.     PUTFILE("sales4.xls")
  28.     IF($result!="OK")
  29.         LOGTO("C:\Users\Carlos\Dekstop\transfer_errors.txt")
  30.         PRINT(GETTIME(FORMAT1).": Error transferring sales4.xls to ".$server)
  31.         STOPLOG
  32.     END IF
  33.  
  34.     $result=PUTFILE("sales5.xls")
  35.     IF($result!="OK")
  36.         LOGTO("C:\Users\Carlos\Dekstop\transfer_errors.txt")
  37.         PRINT(GETTIME(FORMAT1).": Error transferring sales5.xls to ".$server)
  38.         STOPLOG
  39.     END IF
  40.     CLOSEHOST
perfect - my script is now working on localhost test servers - but not in real.
i only get 0 Bytes on the ftp serves
FTP Script
  1. $USER="user"
  2. $PASSWORD="pw"
  3. $LOGDATEI="C:\TMP\FTP\LOGS\TransferLog-".GETTIME(FORMAT0).".txt"
  4. $WAAGENIPS="192.168.1.1|192.168.5.2|192.168.11.1"
  5.  
  6. #++++++++
  7. #DOWNLOAD
  8. #++++++++
  9.  
  10. OPENHOST("ftp.strato.com","user","password")
  11. EXEC("del /f /q C:\Users\Michi\Desktop\FTP_WERBUNG\NEUTRAL\*.jpg")
  12. LOCALCHDIR("C:\Users\Michi\Desktop\FTP_WERBUNG\NEUTRAL")
  13. LOGTO($LOGDATEI)
  14. GETFILE("Neutral/*.jpg")
  15.  
  16. #++++++
  17. #UPLOAD
  18. #++++++
  19.  
  20. FOREACH $WAAGE IN $WAAGENIPS
  21. $ERG=OPENHOST($WAAGE,$USER,$PASSWORD)
  22. IF($ERG=="OK")
  23. LOCALCHDIR("C:\Users\Michi\Desktop\FTP_WERBUNG\NEUTRAL")
  24. GETLIST($filelist,LOCAL_FILES)
  25. CHDIR("permanent")
  26. DELETEFILE("*.jpg")
  27. FOREACH $file IN $filelist
  28.  $result=PUTFILE($file)
  29.  IF($result!="OK")
  30.      $result=PUTFILE($file)
  31.      IF($result!="OK")
  32.          OPENHOST($WAAGE,$USER,$PASSWORD)
  33.          PUTFILE($file)
  34.      END IF
explain: first Download the Image to Folder on my Desktop, then upload all the files to the servers....

Can you help`?
Try with the latest version (4.1). If it does not work please set the output to "verbose" (lower right corner of the ScriptFTP window) and post here