UNZIP Extract file(s) from a zip archive |
Top Previous Next |
This script command extracts file(s) from an existing zip archive file. Upon completion of the command, the %unzipcount script variable contains the total number of files unzipped by this command.
Consider the following example in which a single file is extracted to Robo-FTP’s working folder.
UNZIP "zipfile" "" "mydata.xml"
The example below extracts all the .xml files in the specified archive to Robo-FTP’s working folder. (Files saved with path information will not be extracted unless the /subdirs option is specified.)
UNZIP "zipfile" "" "*.xml"
The example below extracts all the .xml files in the specified archive to Robo-FTP’s working folder and into subfolders that may have been saved in the archive. Relative path names of any files found in the archive are restored.
UNZIP "zipfile" "" "*.xml" /subdirs
The example below extracts a file named index.html from a password protected archive and saves it in a target folder named c:\mysite.
UNZIP "zipfile" "c:\mysite" "index.html" /pw=mysecret
The example below extracts all newer files in the specified archive to the specified target folder.
UNZIP "c:\temp\archive.zip" "c:\my files" "*.*" /skipolder
If you have multiple file to unzip, the example below shows a loop that gathers zip files, one by one, from the current folder and extracts all files in the specified archive to the specified target folder.
:loop GETNEXTFILE "*.zip" /timeout=10 ;; branch if no more zip files IFERROR $ERROR_WAIT_TIMED_OUT goto no_file UNZIP %nextfile "c:\myfiles" "*.*" GOTO loop :no_file
Related Command(s): WORKINGDIR, ZIP
|