> ## 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` 中將路徑設定為這些檔案。有關 ArcScript 中陣列屬性的更多資訊，請參閱 [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>
```
