Zip Method

Action2 Example

 

Encapsulates the AutoMate™ action in the “Zip” group, “Zip files”. he method zips the files you specify into a valid zip file.

 

Declaration

function Zip (varFilesToZip As Variant,

varFilesToExclude As Variant,

varZipFilename As Variant,

intIncludeSubDirs As Integer,

intPreservePaths As Integer) As Integer

 

Parameters

varFilesToZip

 Contains the filenames (including paths) to be included in the zip file. Separate multiple files with a semi-colon ( ; )

 

varFilesToExclude

 Contains the filenames (including paths) to be excluded from the list provided in varFilesToZip. See description below for more details. 

 

varZipFilename

 The filename and path of the zip file to create.

 

intIncludeSubDirs

 Set this parameter to “0” if you do not want to include subdirectories in the zip file, or set it to “1” if you do.

 

intPreservePaths

 Set this parameter to “0” if you do not want to preserve the paths of the files that are being added. Set it to “1” if you want to store the relative directory information in the zip file. Or set it to "2" if you want to store the absolute directory information.

 

Description

The Zip method compresses the files contained in varFilesToZip into one valid zip archive with the filename varZipFilename. You may use any number of wildcards in varFilesToZip to compress one or more directories. In this case, you can use varFilesToExclude to exclude certain files that match another mask. For example, if you want to compress everything in the directory “C:\scripts” except files ending with .txt, you would set varFilesToZip to “C:\scripts”, and varFilesToExclude to “C:\*.txt.”

 

Setting intIncludeSubDirs to “1” will cause the Zip method to compress the directories you specify as well as any directories contained within. Setting it to “0” will cause the Zip action to ignore any directories it encounters.

 

Setting intPreservePaths will cause the Zip method to store information about the path of the file being compressed into the zip archive. This path can then be used when unzipping the archive to restore the same file structure as it existed when the file was compressed. Setting intPreservePaths to “0” will cause all the files to be compressed into one area, and unzipping the archive will unzip all the files into the same directory.