Skip to content

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).

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).
ParameterTypeDefaultDescription
sourcestring—Path of the ZIP file to extract.
destinationstring—Folder to extract the content into.
ParameterTypeDefaultDescription
overwritebooltrueReplace files that already exist in destination.

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.

MessageCause 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.

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: folder
List Files path = folder pattern = "*.xlsx" recursive = true → output: files
For Each items = files itemVariable = path
└─ activities:
Read Excel Sheet path = path → output: data
... process ...