Application icon

Zip / Unzip

This function can zip the contents of a file or folder to a file or it can unzip a file to a folder.

When zipping a folder, the process is not deep. Folders in the specified folder are not included and path information is not included in the zip file.

When zipping, a preexisting copy of the zip file will be deleted.

When unzipping, the destination folder will be created if it does not exist. Preexisting items in the folder with the same name as an item in the zip file will be overwritten.

Both file paths must be absolute (begin with a / character). By default, if the zip file specification does not end with .zip, it will be appended. If the Do not force .zip filename extension setting is checked, an existing filename extension will be preserved. Note that if there is no filename extension, .zip will still be appended.

The text fields may contain any of the escape sequences described in Escape Sequences.

Regardless of the execution mode, the function is only executed once.

The action test state is set to true if the operation works, otherwise false. When set to false the Data Source Access Error named variable will be set as follows:

1
error launching the script

2
error removing preexisting zip file (Zip)

3
source folder does not exist or is a file (Zip)

4
nothing to zip (Zip)

5
the zip file exists and is a folder (Zip)

6
the destination folder is a file (Unzip)

7
the zip file's path is not absolute

8
the source folder's path is not absolute

9
zip file does not exist or is a folder (Unzip)

A negative integer
a negated zip or unzip error code.