> ## 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.

# zipScan

> 掃描壓縮存檔，並傳回其中包含的檔案和目錄的中繼資料。

掃描壓縮存檔，以取得有關其包含的檔案和目錄的資訊。

## 必需的參數

* **type**: 存檔的型別。允許的值為 ZIP、TAR、JAR 和 GZIP。預設值為 ZIP。
* **archive**: 要掃描的存檔在磁碟上的路徑，包括檔名。

## 輸出屬性

* **zip:filename**: 檔案或目錄的名稱，包括路徑。
* **zip:compressedsize**: 檔案壓縮後的大小（以位元組為單位）。
* **zip:decompressedsize**: 檔案解壓縮後的大小（以位元組為單位）。
* **zip:lastmodified**: 檔案或目錄上次修改的日期和時間。

## 範例

以下範例掃描現有 zip 存檔，並不斷向輸出資料追加存檔中每個檔案和目錄的資訊。掃描完所有檔案和目錄後，資料將作為輸出檔案推送。

```xml theme={null}
<!-- Creating the input item and the necessary attributes -->
<arc:set attr="zip.archive" value="C:\\Temp\\test.zip" />
<arc:set attr="zip.type" value="ZIP" />
<!-- Initializing the output data -->
<arc:set attr="output.data" value="" />

<arc:call op="zipScan" in="zip" out="results">
  <!-- Appending the information of each file and folder to the output data -->
  <arc:set attr="output.data" value="[output.data]\nThe file [results.zip:filename] has a compressed size of [results.zip:compressedsize] bytes and an uncompressed size of [results.zip:decompressedsize] bytes. The last modified time is [results.zip:lastmodified]." />
</arc:call>

<!-- Pushing the output item out as a file -->
<arc:set attr="output.filename" value="result.txt" />
<arc:push item="output" />
```

輸出資料如下所示：

```
The file zipthis\ has a compressed size of 0 bytes and an uncompressed size of 0 bytes. The last modified time is 2023-01-31 10:29:18.
The file zipthis\movies.xml has a compressed size of 252 bytes and an uncompressed size of 782 bytes. The last modified time is 2022-11-15 13:14:36.
The file zipthis\rickybobby.xml has a compressed size of 74 bytes and an uncompressed size of 78 bytes. The last modified time is 2022-11-21 13:31:54.
The file zipthis\subaru.xml has a compressed size of 97 bytes and an uncompressed size of 172 bytes. The last modified time is 2022-10-31 15:11:06.
The file MyTest\ has a compressed size of 0 bytes and an uncompressed size of 0 bytes. The last modified time is 2023-08-29 16:40:06.
The file MyTest\file1.xml has a compressed size of 5348 bytes and an uncompressed size of 50304 bytes. The last modified time is 2023-08-29 16:40:06.
The file MyTest\file2.xml has a compressed size of 4135 bytes and an uncompressed size of 40953 bytes. The last modified time is 2023-08-29 16:40:06.
The file MyTest\file3.json has a compressed size of 5717 bytes and an uncompressed size of 46924 bytes. The last modified time is 2023-08-29 16:40:06.
The file MyTest\file4.json has a compressed size of 8320 bytes and an uncompressed size of 75023 bytes. The last modified time is 2023-08-29 16:40:06.
```
