AddToZip

<< Click to Display Table of Contents >>

Navigation:  Handling Events via Scripting > Objects and Functions > File management functions >

AddToZip

function AddToZip(FileMask, ZipFile: string): boolean;

 

This function adds a file (or multiple files via wildcard file mask) to a ZIP archive. If the ZIP archive does not exist, it will be automatically created.

 

Parameters

FileMask

The fully qualified file name or file mask (including full path) to be zipped; typical Windows wildcards (? and *) are supported

ZipFile

The fully qualified file name of the destination ZIP archive (including full path)

 

Return value

True

The file(s) was successfully zipped

False

Error while compressing file(s); nothing was added to the zip archive

 

Remarks

This function could take a very long time to execute depending on the size of the file(s) you are compressing. Please take that into account before using this function in your script. A wise habit is to always check the original file size before adding it to a zip archive. This can be done using the FileSize function.