# Decompress task

A Decompress turns each compressed file on the list back into the file it was: `report.csv.gz` becomes `report.csv`. It is the other half of [Compress](Task-Compress.md). For archives that hold several files, use [Unzip](Task-Unzip.md).

Give the task a filter for the compressed files, such as `*.gz`.

## Fields

| Field | What it does | On a new task |
|---|---|---|
| **File Path** | the file to write, for each item: `file:///data/in/{stem}` takes the last ending off, so `report.csv.gz` is written as `report.csv`. **Browse**. | |
| **Decompression Type** | **GZIP**, **BZIP2**, **LZMA**, **XZ**, **Z** (the old Unix compress), **PACK200** | |
| **Delete original** | the compressed file is deleted when it was unpacked | off |
| **Retry failed action x times**, **Retry delay** (seconds), **Slow down retries with each failure.** | for files on other servers | 0, 0, off |

When no type is chosen, the task looks at the file itself and recognises its kind: "Detected compression type: …". So a job that gets `.gz` from one partner and `.bz2` from another needs one task, with the type left empty.

## What it hands on

| With | The list afterwards holds |
|---|---|
| nothing ticked | the compressed files, as before. The unpacked files are written but are not on the list. |
| **Delete original** | the unpacked files, in place of the compressed ones |

To go on with the unpacked files while keeping the compressed ones, unpack into a folder of the job's own and put a [Find](Task-Find.md) there.

## Things to know

- **`{stem}` is the name without its last ending.** That is exactly what a compressed file needs: `data.xml.bz2` gives `data.xml`.
- **Files written in pieces.** A `.gz` made by gluing several gzip files together is read to its end. Rubbish after the last complete piece is left out, with a line in the log: "Ignoring trailing data after the last complete …".
- **Size.** A compressed log can be twenty times its size unpacked. Unpack on a disk with room.
- **`.tar.gz`** is an archive inside a compressed file: [Unzip](Task-Unzip.md) handles it in one step. Decompress would give you the `.tar`.
- **A long list** is worked through item by item, and a run that is interrupted goes on with the file it was at.
