必需的参数
- type: 存档的类型。允许的值为 ZIP、TAR、JAR 和 GZIP。默认值为 ZIP。
- archive: 要扫描的存档在磁盘上的路径,包括文件名。
输出属性
- zip:filename: 文件或目录的名称,包括路径。
- zip:compressedsize: 文件压缩后的大小(以字节为单位)。
- zip:decompressedsize: 文件解压缩后的大小(以字节为单位)。
- zip:lastmodified: 文件或目录上次修改的日期和时间。
示例
以下示例扫描现有 zip 存档,并不断向输出数据追加存档中每个文件和目录的信息。扫描完所有文件和目录后,数据将作为输出文件推送。<!-- 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.