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 a newbie! I've got a great script set up to download some remote files, and then archive them by downloading and uploading a new folder and then deleting the originals, however, I can't get my EXEC command to work to delete the local files after upload. can someone help please? script so far:
FTP Script
  1. # Connect to FTP server
  2. OPENHOST("XXXX","XXXX","XXXX")
  3.  
  4. # Go to download dir
  5. LOCALCHDIR("pathhere")
  6.  
  7. # Get all the files in the FTP server
  8. GETFILE("/remotefiles/*.csv")
  9.  
  10. # Change current local temp dir
  11. LOCALCHDIR("temppathhere")
  12.  
  13. # Download remote files to me moved
  14. GETFILE("/remotefiles/*.csv")
  15.  
  16. # Change the current remote directory to archive
  17. CHDIR("/remotefiles/archive/")
  18.  
  19. # Upload the files
  20. PUTFILE("*.csv")
  21.  
  22. # Delete the remote files
  23. DELETEFILE("/remotefiles/*.csv")
  24.  
  25.  
  26. # Delete the local file
  27.  
  28.  
  29. # Close the connection
there's a little space above for the EXEC command.

I'd like to add error handling and email confirmations/errors but I think I'll get this working first!
managed to sort this as we've changed how we want the files. all i need now is for the email confirmation or error to work, however I can't get blat to load, our Anti-virus is blocking it :(
Hello,

Try downloading Blat from its own web site:

http://sourceforge.net/projects/blat/

As you probably know there is an example on how to use blat here: http://www.scriptftp.com/examples.php?go=send_email.ftp

If your antivirus is still blocking blat.exe try adding blat.exe to the antivirus whitelist.

Regarding the local file deleting, take a look at this example:

[scriptftp="delete_local_file.ftp"]# Delete all temporary files from C:\LocalWebFolder
EXEC("del /F /Q C:\LocalWebFolder\*.tmp")[/ScriptFTP]

More info and examples in this help topic:
Handling local files
http://www.scriptftp.com/reference.php?go=topic113