zipExtract

Version 24.2.8965


zipExtract


Extract files and folders from an existing compressed archive.

必要なパラメータ

  • 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 extracted.
  • extractto: The path on disk where the extracted files and folders should be placed.

オプションのパラメータ

  • excludefile#: An array of files to exclude in the archive. For example, to exclude two files, set the paths to those files in excludefile#1 and excludefile#2. See Introduction to ArcScript for more information about array attributes in ArcScript.
  • path#: An array of paths within the archive to extract. Each path is relative to the root of the archive and must end in a forward slash (For example <arc:set attr="zip.path" value="zipthis/" />). If this is not set, all paths in the archive are extracted.

アウトプット属性

  • zip:result: If the operation was successful, SUCCESS is returned.

This example extracts only the zipthis folder from the zip archive located at /home/mydata.zip and places it in the /tmp/foo directory on disk. All files in the archive with a .txt extension are ignored and not extracted.

<!-- 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>