Pack folder
Audience:
Low-code EngineersSkill Prerequisites:
Tokens
Compresses the contents of a folder into an archive file, such as a .zip or .7z file, and saves it in a folder of your choice. Details of the new archive, such as its URL and file ID, can be saved as tokens so it can be downloaded, emailed or uploaded by the actions that follow.
Typical Use Cases
- Let users download all the documents of a record in one file
- Bundle generated reports or exports before emailing them or uploading them with Upload to FTP
- Create a backup of a folder before changing or deleting it
Don't use it to
- Compress a single file into a folder that contains other files. The whole folder is always archived. Copy the file into an empty working folder first with Copy File.
- Extract an archive. Use Unpack an archive instead.
Related Actions
| Action Name | Description |
|---|---|
| Unpack an archive | Extracts the files from an archive. |
| Get archive file names | Lists the files in an archive without extracting them. |
| Upload to FTP | Uploads the archive to an FTP server. |
| Delete Folder | Removes a temporary working folder after it has been packed. |
Input Parameter Reference
| Parameter | Description | Supports Tokens | Default | Required |
|---|---|---|---|---|
| Directory to archive | The folder whose contents are archived. Select a folder, or in expression mode enter a path relative to the portal root (for example Clients/Acme/). The folder itself isn't included, only its contents. | Yes | none selected | Yes |
| Store in folder | The folder where the archive is saved. Select a folder, or in expression mode enter a path relative to the portal root using / as the separator. The folder is created if it doesn't exist. It can't be Directory to archive or one of its subfolders. | Yes | none selected | Yes |
| Archive name | The file name of the archive, for example Acme-documents.zip or Acme-documents. Enter a file name only. It's saved in Store in folder. | Yes | empty string | Yes |
| Archive the subfolders | When checked, subfolders of Directory to archive and their contents are included. When unchecked, only the files directly inside Directory to archive are included. | No | Unchecked | No |
| Archive extension | The archive format: zip, 7z, tar, gz, bz2 or xz. When set, it replaces any extension in Archive name. When empty, the format is taken from the extension in Archive name, and the action fails if Archive name doesn't have one. | No | empty | No |
Output Parameters Reference
| Parameter | Description |
|---|---|
| File Output Token Name | Optional. The name of the token that stores details of the archive. See the tokens in the next table. |
If File Output Token Name is Archive, the following tokens are created:
| Token | Description |
|---|---|
[Archive] | The archive's file name, for example Acme-documents.zip. |
[Archive:FileId] | The archive's file ID. |
[Archive:FolderId] | The ID of the folder that contains the archive. |
[Archive:RelativeUrl] | The archive's URL relative to the site root. |
[Archive:AbsoluteUrl] | The archive's absolute URL. |
[Archive:LinkClick] | A LinkClick URL for the archive. |
[Archive:FilePath] | The archive's physical path on the server. |
[Archive:FileSize] | The archive's size in bytes. |
[Archive:MimeType] | The archive's MIME type. |
Considerations
- Use
zipfor sharing. Everyone can open.zipfiles without extra software.7zgives better compression but needs a tool such as 7-Zip. gz,bz2andxzhold a single file. These formats can only compress one file, so the action fails if the folder contains more than one file. Usezip,7zortarfor folders with several files.- Allowed file extensions. To create output tokens, the archive is registered in the site's file system. If the archive's extension isn't in the site's list of allowed file extensions, the archive is still created on disk but the action fails with Unable to find the file... (The file extension might not be allowed). Add the extension to the allowed list, or use
zip. - Dots in the archive name.
Archive extensionreplaces everything after the last dot inArchive name. For example,Acme Inc.-documentswith extensionzipbecomesAcme Inc.zip. If names can contain dots, include the extension inArchive name(for example[Company]-documents.zip) and leaveArchive extensionempty. - Existing archives are replaced. If a file with the same name already exists in
Store in folder, it's overwritten. - Both folders must be inside the current portal.
Examples
tip
To understand how to use the below examples, please see Running Examples.
1. Zip a customer's documents and let the user download them
The first action zips everything in Clients/<Company>/, including subfolders, into Downloads/<Company>-documents.zip. The second action redirects the browser to the archive's URL so the download starts.
[
{
"Title": "Pack folder",
"ActionType": "Pack",
"Description": "Zip the customer's documents",
"Condition": null,
"Parameters": {
"DirectoryToArchive": {
"Expression": "Clients/[Company]/",
"Value": "",
"IsExpression": true,
"Parameters": {}
},
"StoreFolder": {
"Expression": "",
"Value": "/Downloads",
"IsExpression": false,
"Parameters": {}
},
"GeneratedArchiveName": "[Company]-documents",
"IncludeSubfolders": true,
"ArchiveFormat": {
"Expression": "",
"Value": "zip",
"IsExpression": false,
"Parameters": {}
},
"OutputTokenName": "Archive"
}
},
{
"Title": "Redirect to URL",
"ActionType": "RedirectToUrl",
"Description": "Download the archive",
"Condition": null,
"Parameters": {
"Url": "[Archive:AbsoluteUrl]",
"EscapeUrl": "",
"OpenInPopup": "",
"PopupTitle": "",
"OpenInNewTab": "",
"ForceDownload": true
}
}
]
Revised 09/25/2026