Zip Action Icon

Zip Files Action

Declaration

<AMZIPFILES SOURCE="text" COMPRESSION="options" PATHINFO="options" EXCLUDE="text" OVERWRITE="yes/no" ISNEWER="yes/no" ISNEWERTHAN="datetime" ISOLDERTHAN="datetime" ARCHIVETURNOFF="yes/no" PASSWORD="text" DOSFORMAT="yes/no" ATTRFILTER="text">

See Also

Unzip Action

Description

Compresses files into the Zip file specified. To specify more than one file to compress use wildcards ( e.g. * or ? ). To specify multiple files or wildcard masks, separate them with a vertical bar. Example: c:\*.txt|c:\*.bak

Practical Usage

Usually used to compress files before backing up or in preparation for transfer over the Internet via email or FTP.

Parameters

General Tab

Files to Zip
Text, Required
MARKUP:
a) SOURCE="c:\sourcefoldername\file.txt"
b) SOURCE="c:\sourcefoldername\*.txt"
c) SOURCE="C:\sourcefoldername\*.txt|C:\sourcefoldername\*.doc"
c) SOURCE="file.txt"

Specifies the file(s) to zip. This can be a fully qualified path and filename (preferred) or a single file (requires use of the Change Folder action). Wildcards ( e.g. *.* or ? ) may be used to copy all files matching a certain mask. Multiple file and/or file masks may be specified by separating the entries with the | symbol.

Zip File
Text, Required
MARKUP:
a) DEST="c:\sourcefoldername\file.txt"
b) DEST="c:\sourcefoldername\*.txt"
c) DEST="file.txt"

Specifies the destination folder and filename for the file(s) being zipped. This should be a fully qualified path with a filename. Folders that do not exist will be automatically created at runtime.

Level of Compression
Text, Optional default - normal
MARKUP:
a) COMPRESSION="max"
b) COMPRESSION="fast"
c) COMPRESSION="super_fast"
d) COMPRESSION="none"

Specifies the level of compression that should be used for the file(s) being zipped. The more compression that is used the slower the process. "none" is the fastest option.

Available options are:

max: The highest level of compression, resulting in the smallest files but slower operation.
normal: Standard compression algorithm used in Zip files, offers a good balance of speed and file size.
fast: Faster operation, less compression and slightly larger target file.
super_fast: Even faster operation, even less compression and larger target file.
none: Fastest, no compression applied whatsoever. Useful for combining files into a package quickly when size is not a concern.

Options Tab

Include subfolders
Yes/No, Optional default - YES
MARKUP: SUBFOLDERS="YES"

When set to YES, specifies that, if present, subfolders should be searched for files matching the mask specified in the "Source" [SOURCE] parameter

Preserve Folder Structure
Yes/No, Optional default - relative
MARKUP: PATHINFO="absolute"

Valid only if the "Include subfolder" [SUBFOLDERS] parameter is YES. When set to YES, specifies how path information should be stored in the zip file that is created. If the "Include subfolders" [SUBFOLDERS] parameter is set to NO this parameter is ignored.

none: folder information is not preserved

relative: folder information relative to (beneath) the current folder is stored in the zip file, folders above the current source directory will not be stored. For example If zipping c:\documents\folder\*.*, the path of \folder\ will be stored in the file.

absolute: Full folder information is stored in the zip file, including folders above the current source folder. For example If zipping c:\documents\folder\*.*, the full path of \documents\folder\ will be stored in the file.

Include empty sub folders
Yes/No, Optional default - NO
MARKUP: EMPTYFOLDERS="YES"

Valid only if the "Include subfolder" [SUBFOLDERS] parameter is YES. When set to YES, specifies that subfolders found in the source folder should be created in the destination folder even if they are empty (i.e. they do not contain any files).

Overwrite if exist
Yes/No, Optional default - NO
MARKUP: OVERWRITE="YES"

When set to YES, specifies that, if matching file(s) already exist in the zip file they should be overwritten.

Only if newer
Yes/No, Optional default - NO
MARKUP: ISNEWER="YES"

Valid only if the "Overwrite if exist" [OVERWRITE] parameter is YES. When set to YES, specifies that only matching files that are newer than those in the destination zip file will be overwritten.

Turn archive attribute off
Yes/No, Optional default - NO
MARKUP: ONLYFOLDERSTRUCT="YES"

When set to YES, specifies that the "archive" attribute of the source file(s) should be switched OFF. The Windows "archive" attribute is generally used to track whether a file has been backed-up, by turning the source file's archive attribute off - this indicates to many backup programs that the file has already been backed-up.

Store files in DOS 8.3 format
Yes/No, Optional default - NO
MARKUP: DOSFORMAT="YES"

When set to YES, specifies that the filenames in the zip file should be truncated to their 8.3 DOS style equivalents. Should only be enabled if the zip file will be used on an older operating system that does not support long filenames.

Password protect files
Text, Optional default - (none) no password
MARKUP: PASSWORD="mypassword"

If specified, causes the zip file to be password protected - thus the user will be prompted for a password upon extraction.

Exclude Mask
Text, Optional default - (blank)
MARKUP: EXCLUDE="*.txt"

Causes the action to not zip files matching the mask(s) specified. Filenames or wildcard ( e.g. * or ? ) masks may be used, multiple entries may be specified by separating them with the | symbol (e.g. *.txt|*.bak)

Only if newer than
date, Optional default - (none)
MARKUP: ISNEWERTHAN="%DateSerial(2001,10,12) + TimeSerial(00,00,00)%"

Causes the action to only zip files if the source is newer than the date/time specified. If parameter is left blank or not included, the date of the files will be ignored (excluding "Only if newer" [ISNEWER] parameter).

Only if older than
date, Optional default - (none)
MARKUP: ISOLDERTHAN="%DateSerial(2001,10,12) + TimeSerial(00,00,00)%"

Causes the action to only zip files if the source is older than the date/time specified. If parameter is left blank or not included, the date of the files will be ignored (excluding "Only if newer" [ISNEWER] parameter).

Attributes Tab

Attributes
Text, Optional (blank)
MARKUP:
ATTRFILTER="+R+A-S-H" (move Read Only and Archive files, not system or hidden)
ATTRFILTER="-S" (do not move "system" files)

This group of settings causes the action to filter which files are zipped based on the attribute settings of the source file(s). In visual mode, a group of controls are provided to assist in the selection of this parameter.

In markup mode, build a single text item must be specified that contains the attributes of the files you wish to zip.

Available Options:

R - Read only - Specifying "+R" causes files with this attribute turned on to be included, "-R" causes files with this attribute turned off to be included, not specifying the letter (default) causes this attribute to be ignored.

A - Archive - Specifying "+A" causes files with this attribute turned on to be included, "-A" causes files with this attribute turned off to be included, not specifying the letter (default) causes this attribute to be ignored.

S - System - Specifying "+S" causes files with this attribute turned on to be included, "-S" causes files with this attribute turned off to be included, not specifying the letter (default) causes this attribute to be ignored.

H - Hidden - Specifying "+R" causes files with this attribute turned on to be included, "-H" causes files with this attribute turned off to be included, not specifying the letter (default) causes this attribute to be ignored.

C - Compression - Specifying "+C" causes files with this attribute turned on to be included, "-C" causes files with this attribute turned off to be included, not specifying the letter (default) causes this attribute to be ignored.

Notes

Standard Error Handling Options
This action also includes the standard "Error Causes" and "On Error" failure handling options/tabs

More on Error Handling Options

Variables and Expressions
All text fields allow the use of expressions by surrounding the expression in percentage signs (example: %MYVARIABLE%, %Left('Text',2)%). To help construct these expressions, a popup expression builder is available in all these fields by pressing F2.
More on variables...
More on expressions...
More on the expression builder...

Example

<AMZIPFILES SOURCE="c:\sourcefolder\*.*" DEST="c:\folder2\targetfile.zip">

<AMZIPFILES SOURCE="c:\sourcefolder\*.*" ZIPFILE="c:\targetfolder\targetfilename.zip" COMPRESSION="fast" PATHINFO="none" EXCLUDE="*.txt" OVERWRITE="YES" ISNEWER="YES" ISNEWERTHAN="%DateSerial(2001,10,12) + TimeSerial(00,00,00)%" ISOLDERTHAN="%DateSerial(2001,10,12) + TimeSerial(00,00,00)%" ARCHIVETURNOFF="YES" PASSWORD="test" DOSFORMAT="YES" ATTRFILTER="+a">