ZipDirectoryPostExecuter
Configuration file |
None. Configuration is done directly with a string in field "Config file". |
Class name |
com.ebd.hub.datawizard.postexec.ZipDirectoryPostExecuter |
Description
File or directory
This postexecuter can be used to zip files in a directory and return the created archive file to the Response (the Response then contains only the zipped files and no data from the mapping).
The ZipDirectoryPostExecuter takes all files from the specified directory or from the directory of a specified file and puts them into a ZIP file.
See examples below.
Restricting to specific files with file patterns
File patterns can also be specified to zip only certain files (note the pipe character). Examples:
./tmp/CreateZip/Demo.txt|*.pdf
./tmp/CreateZip/Demo.txt|*.pdf|*a.csv
./tmp/CreateZip/Demo.txt|*.pdf|*a.csv|invoice.txt
./tmp/CreateZip/Demo.txt|invoice.txt Note: Note that the behavior of the postexecuter here is different from ./tmp/CreateZip/Demo.txt/invoice.txt. See sections above and below.
Ignored files
Files ending with *.tmp or starting with ~ or . and files that have the name Thumbs.db are ignored. Since output files are always created with the name ~...-tmp first, these files are also ignored. Note: There is one exception. If checkbox "Append" is set in the Response, the parameter of the postexecuter defines a folder that contains no files (e.g. ./tmp/CreateZip) and to path of the file of the Response points to this folder (e.g. ./tmp/CreateZip/Demo.txt), the postexecuter creates the file ./tmp/CreateZip/Demo.zip. , which contains a file Demo.txt with content from the mapping.
Deleted files
If a directory has been specified, the directory with all contained files will be deleted.
If a specific file has been specified, the directory remains, but all files (except the one specified in the parameter) are deleted.
If file patterns were specified, only the files that were zipped are deleted. If all files of the directory were deleted, then the directory is also deleted.
Parameters
The only parameter (field Config file) to be specified is the path of the folder in which the files to be zipped are or the path of a specific file in the folder to be zipped (see example below). Variables can be used here as usual (with @VARNAME@).
Examples
If the path ./temp/myContainer is specified in field Config file, all files in this directory are zipped and returned to the Response. The myContainer directory and all included files are deleted. The name of the generated zip file is the name specified as the file name in the Response.
If the path ./temp/myContainer/myfile.txt is specified in field Config file, all files in this directory are zipped and returned to the Response. The myContainer directory is retained and all contained files (except myfile.txt) are deleted. The name of the generated zip file is the name specified as the file name in the Response.