Compress Files Action

Description

Compresses files into the 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 Use

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

Declaration

<AMCOMPRESS TYPE="options" 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">

Example

<AMCOMPRESS SOURCE="c:\sourcefolder\*.*" FILE="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">

General Tab Parameters

Files to Compress: Specifies the file(s) to compress. 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.

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"

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

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

Compression Type: Specifies the type of compression that should be used for the file(s) being compressed. Automated Workflow supports the following compression types: ZIP, CAB, LHA, JAR, GZIP, TAR

Text, Optional default - "zip"
MARKUP:
a) TYPE="zip"
b) TYPE="cab"
c) TYPE="lha"
d) TYPE="tar"

Level of Compression: Specifies the level of compression that should be used for the file(s) being compressed. The more compression that is used the slower the process. "none" is the fastest option. The available options are:

  • max: The highest level of compression, resulting in the smallest files but slower operation.
  • normal: Standard compression algorithm used, 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.

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

Options Tab Parameters

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

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

  • Do not store path: folder information is not preserved

  • Store relative path: folder information relative to (beneath) the current folder is stored in the compressed file, folders above the current source directory will not be stored. For example, if compressing c:\documents\folder\*.*, the path of \folder\ will be stored in the file.

  • Store absolute path: Full folder information is stored in the compressed file, including folders above the current source folder. For example, if compressing c:\documents\folder\*.*, the full path of \documents\folder\ will be stored in the file.

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

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

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

Only if newer: Available 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 compressed file will be overwritten.

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

Turn archive attribute off: When set to YES (selected), 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.

Yes/No, Optional default - NO
MARKUP: ONLYFOLDERSTRUCT="YES"

Store files in DOS 8.3 format: When set to YES (selected), specifies that the filenames in the compressed file should be truncated to their 8.3 DOS style equivalents. Should only be enabled if the compressed file will be used on an older operating system that does not support long filenames.

Yes/No, Optional default - NO
MARKUP: DOSFORMAT="YES"

Password protect files: If specified, causes the compressed file to be password protected - thus the user will be prompted for a password upon extraction.

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

Exclude Mask: Causes the action to not compress 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)

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

Only if newer than: Causes the action to only compress 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).

date, Optional default - (none)

MARKUP: ISNEWERTHAN="%DateSerial(2001,10,12) + TimeSerial(00,00,00)%"

Only if older than: Causes the action to only compress 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).

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

Click Custom to select from other time options (Last 30 seconds, Last 30 minutes, Last 24 hours, Last 30 Days, Last 12 Months, Last 5 Years, Next 30 Seconds, Next 30 Minutes, Next 24 Hours, Next 30 Days, Next 12 Months, Next 5 Years). A expression appears in the text box (e.g., %DateAdd( "s", -30, CStr( Now() ))%) and the Expression check box is selected. You can also click the Expression Builder icon to build a custom expression.

Attributes Tab Parameters

Attributes: This group of settings causes the action to filter which files are compressed based on the attribute settings of the source file(s). In visual mode, a group of controls is provided to assist in the selection of this parameter. In markup mode, a single text item must be specified that contains the attributes of the files you wish to compress.

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.

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)

See Also

Decompress Files Action