CFZIP

The CFZIP tag is used to create, expand, and list the contents of zip files. CFZIP is optionally used in conjunction with the CFZIPPARAM tag.

Usage

<cfzip>

Attributes

Attribute default required summary
ATTRIBUTECOLLECTION A structure containing the tag attributes
ZIPFILE The path and file name of the zip file on which the action will be performed.
SOURCE REQUIRED IF ACTION=CREATE. The path to a file or directory that will be included in the created zip file. CFZIPPARAM can be used to specify multiple files or directories.
ACTION CREATE The action to perform on the zip file. Valid values are: CREATE (creates a new zip file containing the source file/directory), EXTRACT (extracts the contents of an existing zip file), LIST (generates a query object containing a list of the contents of an existing zip file), DEFAULT:CREATE
RECURSE FALSE If ACTION=CREATE, recurse indicates whether or not the subdirectories of the directory specified in the source attribute should be included in the zip file.
FILTER A filter to apply against the files in the source directory. For example, *.txt would include only files with a .txt extension.
COMPRESSIONLEVEL The compression level to apply when creating a zip file. The range is 0 (no compression) to 9 (maximum compression). DEFAULT:8
NEWPATH If the source attribute is a file as opposed to a directory, the newpath attribute can be used to specify a new path for the file being included in the created zip file. If the source attribute is a directory the newpath attribute is ignored.
PREFIX Used with a create action to prepend a prefix to the path of all files in the created zip file.
VARIABLE REQUIRED IF ACTION=LIST, The variable name in which the query generated by the list action will be stored.
DESTINATION REQUIRED IF ACTION=EXTRACT, The directory into which the contents of the zip file will be extracted.
FLATTEN FALSE When extracting the contents of an existing zip file, the flatten attribute indicates whether or not to retain the directory structure of the zip file. A value of true indicates the directory structure will not be retained, while a value of false indicates that the directory structure will be retained. DEFAULT:FALSE
CHARSET Host machine default encoding Used to specify a character set to be used for file operations.
OVERWRITE TRUE Zip: whether to overwrite the contents of a given file.true: overwrites all of the content given file if it exists.false: updates entries of existing file and append new entries to the given file if it exists.UnZip: whether to overwrite the files already extracted:true: If the files are already extracted at the destination specified, the file is overwritten.false: If the files are already extracted at the destination specified, the file is not overwritten and not extracted.DEFAULT: TRUE