Script

FTP

The professional tool to automate FTP, SFTP, FTPS

and schedule FTP batch jobs

MENU MENU
Post a message here if you find anything wrong in ScriptFTP.
Hi,

I am trying to make use of the function GETTRANSFERREDFILESCOUNT() after calling a sync script to copy down files from remote server but it always returns 0.

tested on versions 4.4 and 4.3

test code is like:

...
FTP Script
  1. #open the connection
  2. PRINT("Connecting to remote FTP server ".$ftpServer)
  3. SETPORT($ftpPort)
  4. $result=OPENHOST($ftpServer,$ftpUser,$ftpPassword)
  5. $returncode=1
  6. $file_count=0
  7. $endTimeStamp=GETTIME(YEAR).GETTIME(MONTH).GETTIME(DAY).GETTIME(HOUR).GETTIME(MIN).GETTIME(SEC)
  8.  
  9. IF($result=="OK")
  10.     PRINT("Syncronising ".$taskDescription."...")
  11.     CHDIR($remoteDirToSynchronize)
  12.     $result=SYNC($localDirToSynchronize,$remoteDirToSynchronize,DOWNLOAD)
...


output is like:

...
FTP Script
  1. [ScriptFTP] SSH_FXP_CLOSE (119, 0x0)
  2. [Server ] SSH_FXP_STATUS (119, 0, 'Success')
  3. Downloading not found in local folder /var/www/html/css/jquery.timepicker.css
  4. [ScriptFTP] SSH_FXP_LSTAT (120, '/var/www/html/css/jquery.timepicker.css')
  5. [Server ] SSH_FXP_ATTRS (120)
  6. [ScriptFTP] SSH_FXP_OPEN (121, '/var/www/html/css/jquery.timepicker.css', 1)
  7. [Server ] SSH_FXP_HANDLE (121, 0x0)
  8. [ScriptFTP] SSH_FXP_READ (122, 0x0, 0, 28672)
  9. [ScriptFTP] SSH_FXP_READ (123, 0x0, 28672, 28672)
  10. [ScriptFTP] SSH_FXP_READ (124, 0x0, 57344, 28672)
  11. [ScriptFTP] SSH_FXP_READ (125, 0x0, 86016, 28672)
  12. [Server ] SSH_FXP_DATA (122, 2215 bytes)
  13. [Server ] SSH_FXP_STATUS (123, 1, 'End of file')
  14. [Server ] SSH_FXP_STATUS (124, 1, 'End of file')
  15. [Server ] SSH_FXP_STATUS (125, 1, 'End of file')
  16. [ScriptFTP] SSH_FXP_CLOSE (126, 0x0)
  17. [Server ] SSH_FXP_STATUS (126, 0, 'Success')
  18. [ScriptFTP] SSH_FXP_REALPATH (127, '/var/www/html/css/')
  19. [Server ] SSH_FXP_NAME (127, 1 item)
  20. [ScriptFTP] SSH_FXP_STAT (128, '/var/www/html/css')
  21. [Server ] SSH_FXP_ATTRS (128)
  22.  
  23. 0
...


I also tried usage like

...
FTP Script
  1. $result=SYNC($localDirToSynchronize,$remoteDirToSynchronize,DOWNLOAD)
  2. $longStatus=$file_count." files syncronised from ".$ftpServer." ".$remoteDirToSynchronize
  3. PRINT($longStatus)
...


which also results in 0 when echo'd e.g.

...
FTP Script
  1. 0 files syncronised from 192.168.1.100 /var/www/html/css/
...

Every other aspect of the script is working correctly, but I would really like to be able to tell how many files were downloaded.


Any help would be appreciated.