ZIP Compress
ZIP Compress
Section titled “ZIP Compress”Type: zip-compress · Package: ZIP Activities v1.0.5 · Output: string
Compresses a whole folder or a list of files into a ZIP file. Returns the path of the created ZIP.
How it works
Section titled “How it works”Give the destination (destination) and one of the two sources. If you give both, sourceFolder is used and files is ignored.
sourceFolder: compresses all its content (files and sub-folders, empty ones included), keeping the structure. The folder itself does not appear inside the ZIP: its content sits at the root.files: adds each file at the root of the ZIP under its name (the source folder is not kept). Files that do not exist are skipped with a warning in the log (A file in the list was not found and was skipped.), without failing; if none exists, the ZIP ends up empty. Avoid two files with the same name from different folders: they would be duplicated inside the ZIP.- Overwriting: with
overwrite = true(default) an existing ZIP is deleted before compressing; withfalse, the activity fails if the destination exists. - Destination folder: created if missing. Don’t save the ZIP inside the folder you are compressing.
Required parameters
Section titled “Required parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
destination | string | — | Path of the output ZIP file, including its folder. |
Optional parameters
Section titled “Optional parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
sourceFolder | string | — | Folder to compress (all its content). Give this or files. |
files | List | — | List of file paths to compress (alternative to sourceFolder). A single path as text is also accepted. |
overwrite | bool | true | Replace the destination ZIP if it already exists. |
Output
Section titled “Output”Returns a string with the path of the created ZIP (as you gave it in destination).
Common errors
Section titled “Common errors”| Message | Cause and fix |
|---|---|
'sourceFolder' or 'files' is required. | You gave no source (or both expressions evaluated to null). |
Could not find a part of the path '…'. | sourceFolder does not exist. Check it first with dirExists(folder). |
The file '…' already exists. | The destination exists and overwrite is false. |
The process cannot access the file '…' because it is being used by another process. | The destination ZIP or a source file is open in another program. |
'destination' is required. | The destination expression evaluated to null. |
Examples
Section titled “Examples”Compress a folder:
ZIP Compress destination = "C:/outbox/documents.zip" sourceFolder = "C:/output/documents" → output: zipPathLog message = "ZIP ready at " + zipPathCompress specific files and send them:
List Files path = "C:/invoices" pattern = "*.pdf" → output: pdfsZIP Compress destination = "C:/outbox/invoices.zip" files = pdfs → output: zipPathSMTP Send ... subject = "Monthly invoices" attachments = arr(zipPath)Related activities
Section titled “Related activities”- ZIP Extract — the reverse operation.
- ZIP Add File — add to an existing ZIP.
- SMTP Send — email the ZIP.