ZIP Extract
ZIP Extract
Section titled “ZIP Extract”Type: zip-extract · Package: ZIP Activities v1.0.5 · Output: string
Extracts the content of a ZIP file into a destination folder. Returns the path of the folder it was extracted to. Useful to process files that arrive compressed (an email with a ZIP of invoices).
How it works
Section titled “How it works”Unpacks the ZIP at source into destination, keeping the sub-folders it contains.
- Destination folder: created if missing. Files already in it are kept; those with matching names are replaced (with
overwrite = true, the default). - With
overwrite = false, the activity fails on the first file that already exists; the files before it have already been extracted. - Safety: if an inner path of the ZIP tries to escape
destination, the activity fails without writing outside it. - The original ZIP is neither changed nor deleted. Password-protected ZIP files are not supported.
- The log shows how many files the destination folder holds after extracting (including those already there).
Required parameters
Section titled “Required parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
source | string | — | Path of the ZIP file to extract. |
destination | string | — | Folder to extract the content into. |
Optional parameters
Section titled “Optional parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
overwrite | bool | true | Replace files that already exist in destination. |
Output
Section titled “Output”Returns a string with the destination folder path (as you gave it in destination). To get the extracted files, list that folder with List Files.
Common errors
Section titled “Common errors”| Message | Cause and fix |
|---|---|
ZIP file not found. | source does not exist. Check it with File Exists. |
End of Central Directory record could not be found. | The file is not a valid ZIP (corrupted, incomplete or another format such as .rar or .7z). |
The file '…' already exists. | overwrite is false and a file from the ZIP already exists in the destination. Extract to an empty folder or use overwrite = true. |
Extracting Zip entry would have resulted in a file outside the specified destination directory. | The ZIP contains paths pointing outside the destination folder. It is not a trustworthy ZIP. |
'source' is required. / 'destination' is required. | The parameter’s expression evaluated to null. |
Example
Section titled “Example”Extract a ZIP into a folder of its own for this run and process its files:
ZIP Extract source = zipPath destination = pathJoin("C:/temp/extracted", now().ToString("yyyyMMdd_HHmmss")) → output: folderList Files path = folder pattern = "*.xlsx" recursive = true → output: filesFor Each items = files itemVariable = path └─ activities: Read Excel Sheet path = path → output: data ... process ...Related activities
Section titled “Related activities”- ZIP Compress — the reverse operation.
- List Files — list what was extracted.