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

# zipExtract

> 从现有压缩存档中将文件和文件夹提取到磁盘上的指定位置。

export const siteNameShort = "知行之桥";

从现有压缩存档中提取文件和文件夹。

## 必需的参数

* **type**: 存档的类型。允许的值为 ZIP、TAR、JAR 和 GZIP。默认值为 ZIP。
* **archive**: 要提取的存档在磁盘上的路径，包括文件名。
* **extractto**: 磁盘上应放置已提取文件和文件夹的路径。

## 可选的参数

* **excludefile#**: 要从存档中排除的文件数组。例如，要排除两个文件，请在 `excludefile#1` 和 `excludefile#2` 中将路径设置为这些文件。有关 {siteNameShort}Script 中数组属性的更多信息，请参阅 [ArcScript 简介](./operations)。
* **path#**: 存档中要提取的路径数组。每个路径都相对于存档根目录，并且必须以正斜杠结尾（例如 `<arc:set attr="zip.path" value="zipthis/" />`）。如果未设置，则会提取存档中的所有路径。

## 输出属性

* **zip:result**: 如果运算器成功，将返回 SUCCESS。

## 示例

此示例仅从位于 `/home/mydata.zip` 的 zip 存档中提取 `zipthis` 文件夹，并将其放置到磁盘上的 `/tmp/foo` 目录中。存档中所有扩展名为 `.txt` 的文件都会被忽略且不会被提取。

```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>
```
