ZIP        Append file(s) to a zip archive

Top  Previous  Next

Syntax:

ZIP

[ zip name ] [ file ] [ /options ]

Arguments:

[ zip name ]

A variable or string defining the file name of the zip archive to append; if .zip extension is omitted, Robo-FTP adds it automatically; if no folder is specified, Robo-FTP opens the archive in its working folder.

 

[ file ]

A variable or string defining the file or folder to add to the zip archive; if no path name is specified, Robo-FTP assumes [ file ] is in the current working folder. Wildcards may be used to specify multiple files.

Options:

/compress=xx

Select the compression mode for the zip archive; options are /compress=none (files are stored in the zip archive but not compressed); /compress=fast (archive file is created as quickly as possible but file may not be as small as it could be); /compress=normal; /compress=max (archive file is made as small as possible but may take longer to create).

 

/create

Create a new zip archive each time; any existing archive file named [ zip name ] will be deleted and recreated. This option is required when the file specified in the first argument does not exist.

 

/encryption=xx

The supported values are AES and ZIP (the standard ZipCrypto)  ZIP is the default and the AES encryption uses 256-bit keys.

 

/fullpath

Save the fully qualified path or folder names of files as they are stored in the zip archive.

 

/pw=xx

Encrypt zip file with a password to protect the files added to the the zip archive.

 

/subdirs

Add files in subfolders beneath [ file ] to the zip archive; [ file ] must be a folder or a path containing a wildcard pattern for this option to be accepted.

 

 

This script command appends files to an existing zip archive or, if the /create option is specified, it creates a new zip file. Robo-FTP is compatible with the 64-bit zip algorithm so it can create zip archives with a theoretical limit of 18 million terrabytes.

 

Upon completion of the command, the %zipcount internal script variable contains the total number of files zipped by this command.

 

Caution

With the ZIP command the [target] zip is specified before the [source] file to be archived.  This is reversed from many of the other Robo-FTP script commands like UNZIP, PGPENCRYPT and PGPDECRYPT.

 

 

Consider the following example in which a single file is zipped into a new archive. The resulting archive file is named zipfile.zip and is located in Robo-FTP’s working folder.

 

ZIP "zipfile" "mydata.xml" /create

 

The following example adds another file to the same archive.

 

ZIP "zipfile" "mydata2.xml"

 

The example below adds all the .jpg and .jpeg files in Robo-FTP’s working folder to an existing password protected archive.

 

ZIP "zipfile" "*.jpg|*.jpeg" /pw=mysecret

 

The example below adds all the .xml files in Robo-FTP’s working folder and in any subfolders to an existing archive. Relative path names of any files found in subfolders are saved in the archive.

 

ZIP "zipfile" "*.xml" /subdirs

 

The example below stores (but does not compress) all the files in Robo-FTP’s working folder and in any subfolders in a new archive. Relative path names of any files found in subfolders are saved in the archive.

 

ZIP "c:\temp\archive.zip" "*" /subdirs /compress=none /create

 

Note: When the TMPFILE command is active, the output [ zip name ] created by this command will have a different name until the compression process is successfully completed.

 

 

Related command(s): UNZIP, PGPENCRYPT, PGPDECRYPT, TMPNAME

See also: Data Compression