How to Zip and Unzip Files

Document created by Adam Arrowsmith Employee on Dec 12, 2016Last modified by Adam Arrowsmith Employee on Sep 25, 2017
Version 3Show Document
  • View in full screen mode

This article describes how to zip and unzip *.zip archive files and set or retain the internal file names.

 

 Get the example process used below from the Process Library here.

 

 

Use Case

You want to create a zip archive file and need to set the file names for the files within the archive as well as the archive itself.

 

Alternatively you want to read in a zip archive file and need to unzip it and retain the file names of the files within the archive.

 

Approach

The important concept to understand for both use cases is the zip and unzip steps make use of an arbitrary connector document property to store the file names of the files within the archive. This connector property is unrelated to the source or destination connectors used in the process. Think of it as an arbitrary variable.

 

To create a zip file:

  1. Obtain source documents.
  2. Set arbitrary connector property for the file names of the files within archive.
  3. Use Data Process shape with a Zip step to zip the current documents, referencing the connector property set above.
  4. If sending to a file-based destination, set file name and remote directory (optional) for desired destination connector.

 

To unzip a file:

  1. Obtain source archive file.
  2. Use Data Process shape with an Unzip step to unzip the archive. Choose an arbitrary connector property in which to store the file names of the files within the archive.
  3. Continue processing as required.

 

Implementation

 

Creating a Zip File

 

  1. Obtain the source documents. 
  2. Use a Set Properties shape to set an arbitrary connector property with the file name of each file within the archive.
  3. Use a Data Process shape with a Zip step to zip the files. Reference the same connector property set in step 2.
  4. If writing to a file-based destination, use another Set Properties shape to set the outbound file name and directory (optional) for the specific destination connector.

 

Unzipping a Zip File

 

  1. Obtain the source zip archive file.
  2. Use a Data Process shape with an Unzip step to unzip the files. Choose an arbitrary connector property in which to store the file name of each file within the archive.
    •  If reading the zip file from a file-based source, choose a different connector property than source connector type to avoid confusion.
  3. Continue processing as required. If you need to reference the file contents file name, choose the same connector property.

 

Usage Considerations

  • Only the WinZip compression format is supported. Other formats such as .rar, .tar, and gzip are not supported.
  • When creating a zip file, all the documents in the current group (i.e. all the documents that reach the Data Process shape at the same time) will be zipped together.
  • Creating or unzipping archives that are password protected is not supported.
  • User Guide: Data Process shape 
1 person found this helpful

Attachments

    Outcomes