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?
Hi Guys, having a bit of a problem trying to get this to work. I have worked out the compare the remote and the local files part of this script,and if the remote file size changes , it will download the new files to the local folder. but I can't seem to get the move the files to another local folder after download. I have tried it different ways and still it does not work. It keeps telling me that the EXEC command, " The syntax of the command is incorrect. " I need it to only move the files to the local folder only if new files are downloaded. Is their another way to do this or can anyone help on this matter.

FTP Script
  1. # Settings
  2. $ftpserver="xxx.xxx.xxx.xxx"
  3. $ftpuser="xxxxx"
  4. $password="xxxxxxxx"
  5.  
  6. # Connect to FTP server
  7. OPENHOST($ftpserver,$ftpuser,$password)
  8.  
  9. # Change the current local directory. The files
  10. # will be downloaded here.
  11. LOCALCHDIR("C:\Users\Admin\Desktop\ASL Order Download")
  12.  
  13. # Change current remote directory to /orders
  14. CHDIR("/orders")
  15.  
  16.      # Get the remote file listing, store it in $list
  17.     GETLIST($list,REMOTE_FILES)
  18.  
  19.     # For each file in $list...
  20.     FOREACH $item IN $list
  21.         # Get the file size of the local and remote file
  22.         $local_file_size=GETFILESIZE(LOCAL,$item)
  23.         $remote_file_size=GETFILESIZE(REMOTE,$item)
  24.        
  25.         # If the sizes are different download
  26.         # local file is replaced if exists
  27.         IF($local_file_size!=$remote_file_size)
  28.             GETFILE($item)  
  29.  
  30. #Move files to local folder after download
  31.  EXEC("move ".$item." C:\Users\Admin\Desktop\ASL Order Upload\")    
  32.  
  33.         END IF
  34.  
  35.  END FOREACH       
  36.  
  37.  
  38. # Close the connection
FTP Script
  1. EXEC('move '.$item.' "C:\Users\Admin\Desktop\ASL Order Upload"')
Thanks for that. That did the trick.
Thanks for the collaboration Wandrey