Sample: Unzip Uploaded Files |
Top Previous Next |
The sample script below is designed to be triggered by the Upload Complete event. When executed by Robo-FTP Server, it moves uploaded zip files to a pre-defined directory, unzips the contents and deletes them. The script automatically quarantines invalid or password protected zip files along with any other files not named with the .zip extension.
LOG "upload_event_script.log" TRACELOG "upload_event_trace.log" MOVE %event_uploadpath "c:\temp" SET zip_path = "c:\temp\" + %event_uploadfile SETRIGHT extension = %event_uploadfile 4 IFNSTRCMPI extension ".zip" GOTO invalid_file UNZIP zip_path "c:\destination" "*" IFERROR GOTO invalid_file DELETE zip_path GOTO done :invalid_file ;; Not a valid zip file MOVE zip_path "c:\quarantine" :done DISPLAY
To configure Robo-FTP Server to launch this event script for all uploads:
Once all these steps are complete, upload a zip file to Robo-FTP server and then check the c:\destination folder for the unzipped contents. Then upload a non-zip file and verify that Robo-FTP Server moves it to the c:\quarantine folder.
See also: Programming Server Event Scripts |