Zip a file or folder
Compresses a file or folder into a zip next to it, or in a folder you choose.
Archive path as a zip
Details #
Makes a zip the way Finder's Compress does. The zip is called after the file (Report.pdf.zip) unless name says otherwise.
Parameters #
| Parameter | Type | Required | Values | What it does |
|---|---|---|---|---|
counter | text | |||
deleteOriginal | any value | Move the original to the Trash after zipping. | ||
destination | text | |||
into | text | The variable that receives the zip's path. | ||
name | text | The zip's name, as a template. .zip is added when missing. | ||
overwrite | text | What to do when the name is taken: rename (the default; name 2.ext), replace or skip. | ||
path | text | The file or folder. Optional when a file trigger fired. | ||
source | text | |||
to | text | The folder for the zip. The file's own folder by default. |
Every step also accepts label, onFailure, timeout and dryRunSafe.
Examples #
- Archive “Project” as a zip
Gotchas #
A folder is zipped with the folder itself inside.
In a dry run it changes nothing and says what it would do.
Names and tokens #
Wherever a name or folder is a template, {{ }} works as everywhere, and these single-brace tokens are filled in by the step itself:
| Token | Gives |
|---|---|
{name} | the file name without its extension |
{ext} | the extension, without the dot |
{fullname} | the whole file name |
{parent} | the name of the folder it is in |
{added:yyyy-MM-dd} | the date the file was added to its folder (Finder's Date Added), in the format after the colon |
{created:…} {modified:…} {opened:…} | the creation, modification and last-opened dates |
{now:…} | today |
{counter:3} | a number that goes up by one each time this step runs, padded to 3 digits |
The counter is kept in shared.hazel.counter.<counter>; counter names it (the default is this macro and step), so two steps that share a counter share the numbers. It survives restarts. Write the rest of a name with {{file.name}}, {{file.ext}} and the other file fields when a file trigger fired.