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.


virus_scan.s

Download

Robo-FTP is built from the ground up to integrate easily with other software packages. This enables you to automate complex workflows.

This example shows how to use the DOSCMD command to call an external program and then use the %lasterror variable to determine what happened.

This example logs onto a remote FTP server, looks for the first file it can find with a .exe extension, downloads the file (deleting it from the server when download is complete), logs off, and scans the file for viruses.

Robo-FTP does not have a built-in virus scanner but it is able to launch external programs via the DOSCMD and EXEC commands. This allows you to use Robo-FTP with virus scanners that allow you to pass the name of the file or folder to be scanned as a command line parameter.

For example, this sample script shows using the McAfee VirusScan Command Line program to scan the downloaded file.

This particular scanning program sets the result code to a nonzero number if a problem file is detected. This example just prints a message when a virus is detected but you could perhaps delete the file, disinfect it, send a warning email, halt the script, or whatever your workflow requires.


  1  FTPLOGON "ftp.mysite.com" /user=myusername /pw=mypassword
  2  FTPGETFILE "*.exe"
  3  IFERROR GOTO done
  4  RCVFILE %sitefile /delete

  5  FTPLOGOFF
  6  SET full_path = %currentlocaldir + "\" + %sitefile
  7  SET cmdline = 'C:\VirusCL\scan "' + full_path + '"'
  8  DOSCMD cmdline /timeout=90
  9  IFNUM= %lasterror 0 GOTO done
 10  CONSOLEMSG "Problem found!"
 11  ; Add code here to handle problem file
 12  :done
 13  STOP
 14  

Browse complete list of scripts