zipScan

Version 24.2.8971


zipScan


扫描压缩档案以获取有关其包含的文件和目录的信息。

必需的参数

  • type: 存档的类型。 允许的值为 ZIP、TAR、JAR 和 GZIP。 默认值为 ZIP。
  • archive: 要扫描的存档在磁盘上的路径,包括文件名。

输出属性

  • zip:filename: 文件或目录的名称,包括路径。
  • zip:compressedsize: 压缩后文件的大小(以字节为单位)。
  • zip:decompressedsize: 解压缩后文件的大小(以字节为单位)。
  • zip:result: 如果操作成功,将返回 SUCCESS。
  • zip:lastmodified:文件或目录上次修改的日期和时间。

示例

以下示例扫描现有的 zip 存档,并不断向输出数据附加有关存档中每个文件和目录的信息。 扫描所有文件和目录后,数据将作为输出文件推送。

<!-- 创建输入项和必要的属性 -->
<arc:set attr="zip.archive" value="C:\\Temp\\test.zip" />
<arc:set attr="zip.type" value="ZIP" />
<!-- 初始化输出数据-->
<arc:set attr="output.data" value="" />

<arc:call op="zipScan" in="zip" out="results">
  <!-- 将每个文件和文件夹的信息附加到输出数据中 -->
  <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>

<!-- 将输出项作为文件推出 -->
<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.