CreateZip
CreateZIP() function archives a list of specified documents (files). It may generate ZIP archive based on files placed in some folder (may be shared) or files attached to the case.
Syntax
CreateZip(pathFilesToZip, pathStoreZip, zipName, password, useAES); CreateZip(pathFilesToZip, pathStoreZip, zipName, password); CreateZip(pathFilesToZip, pathStoreZip, zipName); CreateZip(fileList, zipName, password, useAES); CreateZip(fileList, zipName, password); CreateZip(fileList, zipName); CreateZip(fileList);
Arguments
- pathFilesToZip – (String) a folder path containing files to be archived;
- pathStoreZip – (String) a folder path where ZIP file will be created;
- zipName – (String) a name of the result ZIP file;
- fileList – (FileList) a variable used in AddFileToList() function;
- password – (String) [Optional] a password used to protect the result ZIP file. It must contain at least 6 characters;
- useAES – (Boolean) [Optional] if this parameter is set to true then an increased security level is used for password. Warning! AES encryption provides much better security but some applications may not decode ZIP with such encryption correctly.
Return value
This function returns true or content of the ZIP file.
Type: Boolean
Examples
Example 1:
Files from path c:\amodittemp will be stored as 1 ZIP with the name „amodFilesZip_date.zip” in folder c:\temp. The _date.zip part of the file name will be added automatically and _date will be repalced with the file creation date in the format: yyyyMMddhhmm.
CreateZip("C:\\amodittemp","C:\\temp", "amodFilesZip");
Example 2:
Creates ZIP archive from files placed in File1 and File2 fields on the case form and returns it to user as package.zip file.
fileList=""; AddFileToList(fileList,[File1]); AddFileToList(fileList,[File2]); DownloadFile(CreateZip(fileList),"package.zip");
Example 3:
Creates ZIP archive from files placed in File1 and File2 fields on the case form and assigns it to [Zip] field.
fileList=""; AddFileToList(fileList,[File1]); AddFileToList(fileList,[File2]); [Zip]=CreateZip(fileList,"package.zip");
Example 4:
Creats ZIP archive from files placed in File1 and File2 fields on the case form and assigns it to [Zip] field. The resulting ZIP is going to be password protected. User must enter password specified in the last argument in order to open this zipped file.
fileList=""; AddFileToList(fileList,[File1]); AddFileToList(fileList,[File2]); [Zip]=CreateZip(fileList,"package.zip", "p455w0rd");
Example 5:
Files from path c:\amodittemp will be stored as 1 ZIP with the name „amodFilesZip_date.zip” in folder c:\temp. The _date.zip part of the file name will be added automatically and _date will be repalced with the file creation date in the format: yyyyMMddhhmm. The resulting ZIP is going to be password protected. User must enter password specified in the last argument in order to open this zipped file.
CreateZip("C:\\amodittemp","C:\\temp", "amodFilesZip", "p455w0rd");
Example 6:
It works in the same way as in the example no. 5 above but the resulting ZIP will be encrypted using AES instead of the default encryption.
CreateZip("C:\\amodittemp","C:\\temp", "amodFilesZip", "p455w0rd", true);