Script Library

Sample scripts are provided as-is with no warranty of fitness for a particular purpose. These scripts are solely intended to demonstrate techniques for accomplishing common tasks. Additional script logic and error-handling may need to be added to achieve the desired results in your specific environment.


zip_and_upload.s

Download

Robo-FTP offers full zip and unzip functionality, including AES encryption and decryption for password protected zip files.

This script checks to make sure there are files to send and, if it finds something, creates a zip file named for the date and time. It then uploads the zip file and performs some clean-up (delete the uploaded files and move the zip file to an archive directory).

Note: Robo-FTP Server can automatically unzip uploaded files.


  1  ; Create new time/date stamped log every day
  2  log "upload.log" /new

  3  ; Set the directory where we will archive the zip files
  4  archivedir "C:\archive"
  5  ; Check to see if there are any files to upload
  6  getnextfile "C:\upload\*"
  7  IFERROR= $ERROR_NO_FILE_FOUND goto done
  8  ; Zip all files, using the built-in %datetime variable to name the zip file
  9  set zip_filename = %datetime + ".zip"
 10  zip zip_filename "C:\upload\*" /create

 11  ftplogon "MyUploadSite"
 12  sendfile zip_filename /archive

 13  iferror goto send_error
 14  FTPLOGOFF
 15  ; Clean up by deleting the uploaded files
 16  delete "C:\upload\*"
 17  goto done
 18  :send_error
 19  ; If we can't upload the file, just exit.  We could add
 20  ; any other type error handling we want here.
 21  :done
 22  exit
 23  

Browse complete list of scripts