zipScan

Version 23.4.8839


zipScan


Scan a compressed archive for information on the files and directories it contains.

Required Parameters

  • type: The type of the archive. The allowed values are ZIP, TAR, JAR, and GZIP. The default is ZIP.
  • archive: The path on disk, including the filename, of the archive to be scanned.

Output Attributes

  • zip:filename: The name, including path, of the file or directory.
  • zip:compressedsize: The size, in bytes, of the file when compressed.
  • zip:decompressedsize: The size, in bytes, of the file when decompressed.
  • zip:lastmodified: The date and time the file or directory was last modified.

Example

The following example scans an existing zip archive and continually appends the output data with information about each file and directory in the archive. Once all files and directories have been scanned, the data is pushed as an output file.

<!-- 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 output data looks like this:

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.