# Compress task

A Compress makes each file on the list smaller by writing a compressed copy of it: `report.csv` becomes `report.csv.gz`. Each file gets its own compressed file. To pack several files into one archive, use [Zip](Task-Zip.md).

## Fields

| Field | What it does | On a new task |
|---|---|---|
| **File Path** | the compressed file to write, for each item: `{url}.gz`, or `file:///data/out/{name}.gz`. **Browse**. | |
| **Compression Type** | **GZIP** (`.gz`), **BZIP2** (`.bz2`), **LZMA** (`.lzma`), **PACK200** | |
| **Delete original** | the uncompressed file is deleted when its compressed copy is written | off |

When no type is chosen, the task goes by the ending of the **File Path**: `.gz`, `.bz2`, `.xz`, `.lzma`, `.tar`, `.7z`. In the log: "No compression type set, using …".

- `.7z` works only on the server's own disk (`file://`): "7Z only supported on local filesystem...FILE:// locations."
- `.Z`, the old Unix compress, can be read by [Decompress](Task-Decompress.md) but not written: "Compressing to .Z (Unix compress) is not supported, choose GZ, BZ2, XZ, LZMA, TAR or 7Z."

## Which type

| Type | Use it when |
|---|---|
| GZIP | in doubt. Every system reads it, and it is fast. |
| BZIP2 | size matters more than time |
| XZ, LZMA | the smallest files, the most time |
| PACK200 | only for Java archives, and only where the other side asks for it |

## What it hands on

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

To go on with the compressed files and keep the originals, put a [Find](Task-Find.md) for them behind the Compress, or compress into a folder of the job's own and Find there.

## Things to know

- **Text shrinks, pictures do not.** CSV, XML, JSON and logs become a tenth of their size. JPEG, PDF, video and anything already zipped stay as they are and only cost time.
- **Across servers.** The file can be read from one server and its compressed copy written to another in one step.
- **A long list** is worked through item by item, and a run that is interrupted goes on with the file it was at.
