<cfzip>
Manipulates ZIP and Java Archive (JAR) files.
In addition to the basic zip and unzip functions, use the cfzip tag supports
- deleting entries from an archive
- filter files
- read files in binary format
- list the contents of an archive
- specify an entry path used in an executable JAR file.
This tag may have a body.
This tag is also supported within <cfscript>
Requires Extension: Compress Tags for Jakarta EE (Lucee 7+)
<cfzip
action=delete|list|read|readbinary|unzip|zip
password=string
charset=string
destination=string
entryPath=string
file=string
filter=any
filterDelimiters=string
name=string
overwrite=boolean
prefix=string
recurse=boolean
showDirectory=boolean
source=string
storePath=boolean
variable=string
encryptionalgorithm=string
compressionMethod=string
><!--- body --->[</cfzip>]
| Attribute | Description | Default |
|---|---|---|
action
string, optional
|
edit
The action to take.
|
zip |
password
string, optional
|
edit
Password for the zip file. |
|
charset
string, optional
|
edit
The character set used to translate the ZIP or JAR entry into a text string. Examples of character sets are:
|
|
destination
string, optional
|
edit
Destination directory where the ZIP or JAR file is extracted. |
|
entryPath
string, optional
|
edit
Pathname on which the action is performed. |
|
file
string, optional
|
edit
Absolute pathname of the file on which the action is performed. For example, the full pathname of the ZIP file: c:\temp\log.zip. |
|
filter
any, optional
|
edit
Optional filter.
|
|
filterDelimiters
string, optional
|
edit
Optional when passing a filter pattern. This value is used as a delimiter for the patterns. Default is the pipe "|" character. |
|
name
string, optional
|
edit
Record set name in which the result of the list action is stored. The record set columns are:
|
|
overwrite
boolean, optional
|
edit
unzip: Specifies whether to overwrite the extracted files:
zip: Specifies whether to overwrite the contents of a ZIP or JAR file:
|
|
prefix
string, optional
|
edit
String added as a prefix to the ZIP or JAR entry. The string is the name of a subdirectory in which the entries are added. |
|
recurse
boolean, optional
|
edit
Specifies whether the action applies to subdirectories:
|
|
showDirectory
boolean, optional
|
edit
yes: lists the directories. no: does not list directories. (optional, default= no) |
|
source
string, optional
|
edit
Source directory to be zipped. Not required if cfzipparam is specified. |
|
storePath
boolean, optional
|
edit
zip: Specifies whether pathnames are stored in the ZIP or JAR file:
unzip: Specifies whether files are stored at the entrypath:
|
|
variable
string, optional
|
edit
Variable in which the read content is stored. |
|
encryptionalgorithm
string, optional
|
edit
Supported algorithms are:
|
|
compressionMethod
string, optional
|
edit
Set the zip compression level
|
Examples
editSimple format for cfzip
Action unzip
<cfzip action="unzip" destination="#gettempdirectory()#" file="zippath">
Action delete
<cfzip action="delete" file="#expandpath('./list.zip')#" entrypath="list/hai">
Action zip
<cfzip action="zip" source="#expandpath('./ziptest.txt')#" file="#expandpath("'./zip/')#">
Action list
<cfzip action="list" file="#expandpath('./list.zip')#" name="res">
See also
- Zip files
- Compress()
- Extract()
- IsZipFile()
- <cfzipparam>
- Search Issue Tracker open_in_new
- Search Lucee Test Cases open_in_new (good for further, detailed examples)