Skip to main content
Skip table of contents

Zip

Purpose

This command will zip up files and create a zip archive file.


Parameters

Parameter: ZipWhat
Type: string
Description: Path to a directory, or path and filename of the directory or file to be added to a zip archive file.

Parameter: ZipFileName
Type: string
Description: Path and filename of the Zip archive file to be created or to have files added to.

Parameter: compression (optional)
Type: integer (.NET Short)
Description: The zip file compression level to use - the higher the level, the longer the zip operation will take.  If this parameter is not provided, a default value of 6 is used.  The valid values are from 0 to 9.

Parameter: password (optional)
Type: string
Description: If you wish the file(s) to be password protected in the archive, provide the password here. (Case sensitive)

Parameter: RemoveBase (optional)
Type: boolean
Description: If False, the entire directory structure up to and including the source file or directory will be included in the zip archive.  If this parameter is not provided, then by default it is True and the directory structure before the starting point of the source files will be removed.

Example: ZipWhat is C:\Program Files\HomeSeer\HTML\MyStuff (a directory) MyStuff has sub-directories Stuff1 and Stuff2.

With this parameter True, the resulting archive will have Stuff1\*.* and Stuff2\*.* in it.

With this parameter False, the resulting archive will have Program Files\HomeSeer\HTML\MyStuff\Stuff1\*.* and Program Files\HomeSeer\HTML\MyStuff\Stuff2\*.* in it.

Parameter: Flatten (optional)
Type: boolean
Description: If True, the files will be put in the zip archive without any path information.  Files that have the same filename but are in different subdirectories will result in only one of the files being left in the archive at the end of the Zip function.


Returns

Parameter: Status
Type: String
Description: Returns the status of the zip function. An empty string indicates success, otherwise an error message is returned.


Example

Sample Code

VB
Sub Main(parm as object)
   Dim result as String
   result=hs.Zip("c:\file.txt","c:\file.zip")
   hs.WriteLog("ZIP","Result: " & result)
End Sub


JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.