> ## Documentation Index
> Fetch the complete documentation index at: https://docs.arc.cdata.com/llms.txt
> Use this file to discover all available pages before exploring further.

# zipExtract

> Extracts files and folders from an existing compressed archive to a specified location on disk.

export const siteNameShort = "Arc";

Extract files and folders from an existing compressed archive.

## Required Parameters

* **type**: The type of the archive. The allowed values are ZIP, TAR, JAR, and GZIP. The default is ZIP.
* **archive**: The path on disk, including the filename, of the archive to be extracted.
* **extractto**: The path on disk where the extracted files and folders should be placed.

## Optional Parameters

* **excludefile#**: An array of files to exclude in the archive. For example, to exclude two files, set the paths to those files in `excludefile#1` and `excludefile#2`. See [Introduction to ArcScript](./operations) for more information about array attributes in {siteNameShort}Script.
* **path#**: An array of paths within the archive to extract. Each path is relative to the root of the archive and must end in a forward slash (For example `<arc:set attr="zip.path" value="zipthis/" />`). If this is not set, all paths in the archive are extracted.

## Output Attributes

* **zip:result**: If the operation was successful, SUCCESS is returned.

## Example

This example extracts only the `zipthis` folder from the zip archive located at `/home/mydata.zip` and places it in the `/tmp/foo` directory on disk. All files in the archive with a `.txt` extension are ignored and not extracted.

```xml theme={null}
<!-- Creating the input item and the necessary attributes -->
<arc:set attr="zip.archive" value="/home/mydata.zip" />
<arc:set attr="zip.type" value="ZIP" />
<arc:set attr="zip.extractto" value="/tmp/foo" />
<arc:set attr="zip.excludefile#" value="*.txt" />
<arc:set attr="zip.path#" value="zipthis/" />

<arc:call op="zipExtract" in="zip">
  <!-- Optional logging step to log the status of the operation to the application log. -->
  <arc:set attr="_log.info" value="The zipExtract operation for connector [ConnectorId] has finished with a status of [results.zip:result]." />
</arc:call>
```
