CF_ZIP
The CF_ZIP tag allows you to perform all ZIP related operations. Using CF_ZIP, you can perform standard zip operations like Zip and UnZip along with some advanced features like Delete, Extract and List.
See also CF_ZIPPARAM.
Syntax
<CF_ZIP FILE="filename"
ACTION="action"
NAME="queryname"
DESTINATION="full_path_name"
PASSWORD="password"
NAMECONFLICT="behavior"
CREATENEW="boolean"
SUBFOLDERS="boolean"
USEPATH="boolean">
</CF_ZIP>
FILE
Required. File on which all ZIP related operations will be performed.
ACTION
Required. Specifies the action. These are possible values
- Zip
zip given files and folders, files and folders can be specified using CF_ZIPPARAM tag
- UnZip
unzip given zip file at given path and return query listing of all unzipped files and folders
- List
return query listing of all files and folders exist in given zip file
- Extract
extract a file from existing zip file, file to be extract can be specified using CF_ZIPPARAM tag
- Delete
delete a file from existing zip file, file to be delete can be specified using CF_ZIPPARAM tag
NAME
Optional. The name to assign to a query when a query is constructed from CF_ZIP. If no name is specified then a default name CF_ZIP is used to construct query.
DESTINATION
Optional. This is target folder path where all files will be unzipped.
PASSWORD
Optional. This property is used to specify password to handle password protected archives. If not specified then no encryption or decryption takes place.
NAMECONFLICT
Optional. This parameter is used to handle the situation if the file name conflicts with the name of another file that already exists in the directory. Valid values are
- MakeUnique
tag will save file with unique file name if file with same name already exists and will return its new name
- OverWrite (default)
tag will overwrite to existing file if file with same name already exists
CREATENEW
Optional. This is the parameter used to inform CF_ZIP tag whether to create new zip file in case zip file already exists. Valid values are
- TRUE (default)
if this flag is set as TRUE then tag will always create new zip file in case file already exists
- FALSE
if it is set as FALSE then tag will not create new file, will add to existing zip file in case file already exists
SUBFOLDERS
Optional. This parameter is used to inform CF_ZIP tag whether to add subfolders automatically along with files. Valid values are
- TRUE (default)
if this value is set as TRUE then tag will add subfolders to zip file automatically
- FALSE
if this value is set as FALSE then tag will zip files only and will ignore all subfolders
USEPATH
Optional. This parameter is used to inform CF_ZIP component whether to zip given files using their complete path or using their names only. This property is ignored in case of adding folders to zip. Valid values are
- TRUE (default)
in case of TRUE tag will zip files using their complete path
- FALSE
if it is set as FALSE then tag will zip files using their names only
Evaluating the query results
The following table lists the information returned by CF_ZIP when you specify the ACTION attribute to be either UnZip or List. All of the columns are returned if you specify action as UnZip, but column named SavedName is not returned in case action is List.
| Columns Information |
| Column Name | Description |
queryname.Name | contains name of the file or directory. |
queryname.SavedName | contains name of the file or directory if it is saved with some other file name. |
queryname.Type | contains type, whether it is a file or directory. |
queryname.Size | contains size of the file. |
queryname.PasswordRequired | contains value Yes or No, whether the file is password protected or not. |
Example
<!--- This example shows the use of CF_ZIP to get listing of
files and folders --->
<HTML>
<HEAD>
<TITLE>CF_ZIP Example</TITLE>
</HEAD>
<BODY>
<H3>CF_ZIP Example</H3>
<P>This example shows the ability of CF_ZIP to get
listing of files and foldes, and shows how you can display the
query result by using the query returned by CF_ZIP.</P>
<CF_ZIP FILE="c:\myfolder\myfile.zip"
ACTION="LIST"
NAME="myzip">
</CF_ZIP>
<CFOUTPUT query="myzip">
Name: #name#<BR>
Type: #type#<BR>
Size: #size#<BR>
PasswordRequired: #passwordrequired#<BR>
</CFOUTPUT>
</BODY>
</HTML>