# Unzip task

An Unzip unpacks the archives on the list and puts the files that were in them on the list.

Give the task the filter `*.zip`, or whatever your archives end in. With the filter `*` it tries to unpack every item it is given, and fails on the first that is not an archive.

## Fields

| Field | What it does | On a new task |
|---|---|---|
| **Output Location** | the folder to unpack into, as an address ending in `/`. Empty: the folder the archive is in. **Browse**, **Test**. | |
| **Unzip into its own folder.** | each archive is unpacked into a folder with its own name without the ending: `orders.zip` into `orders/` | off |
| **File name filter.** | only the files in the archive that match are unpacked | `*` |
| **Delete original .zip** | the archive is deleted when it was unpacked | off |
| **Internal Unzipping** / **External 'unzip' Unzipping** | **Internal**: the server unpacks. **External**: the operating system's `unzip` is called; on Linux and macOS only, and not on a server in restricted mode. | Internal |
| **Skip not readable files** | a file in the archive that cannot be read is left out; without it the task fails there | off |
| **Allow stored entries with data descriptor** | accepts a kind of zip some programs write that strict readers refuse | on |
| **Retry failed unzip x times**, **Retry delay** (seconds), **Slow down retries with each failure.** | for archives on other servers | 0, 0, off |
| **Route connection through DMZ when possible** | the connection is made from a DMZ server | |

"tar and tar.gz are also supported formats. They will be handled if the extension of the file is either .tar or .tar.gz".

## What it hands on

The items it was given, and behind each archive the files that came out of it, at the place they were unpacked to. With **Delete original .zip**, the archive itself leaves the list.

Each unpacked file is an item like any other, with `{name}`, `{path}`, `{size}`. So a job can go straight on: Unzip, then a Copy with the filter `*.csv` for the files it wants.

## Things to know

- **Folders in the archive** are made in the output location as they are in the archive.
- **Unpack to somewhere else.** Unpacking into the folder the archive arrived in is asking for trouble where that folder is watched or is a user's upload folder. Give an **Output Location** of the job's own, such as `file:///data/work/{stem}/`.
- **Paths that try to leave.** An archive can hold file names with `../` in them, made to write outside the folder it is unpacked into. Such names are not followed out of the output location.
- **Archives from users.** A small archive can unpack to a huge amount of data. Unpack what users upload on a disk with room, not on the system disk.
- **Passwords.** The task has no field for a password: an archive that is protected with one cannot be unpacked by it.
- **A single compressed file** (`.gz`, `.bz2`, `.xz`) is not an archive: use [Decompress](Task-Decompress.md).
