All Articles

Find ZIP files embedded within ZIP files

Boomi can unzip files with the Data Process shape. Although, sometimes you might have both zip files and unzipped filed embedded within a zip file, which makes it difficult to determine which files should be unzipped and which should not unzipped. To be able to do this decision, you will need to use a Decision Shape that will perform a regular expression (RegEx) against the file’s current data. The beginning of all ZIP files start with PK/u0003/u0004 (The letter PK, Unicode U+0003, and Unicode U+0004). The example is setup to look at those first characters to determine if the file needs to be unzipped.

Process Overview

Figure 1. Basic outline of process to unzip files that are embedded within zip files.

The Decision Shape at step 1 checks to see if the file begins with PK\u0003\u0004. If the file does begin with those characters, then the file is unzipped in step 2. Next, at step 3, a decision is make if the file is a zip file. If the file is a zip file, then is loops back to be unzipped. The loop will allow for unzipping files multiple times if needed. Below is the decision shape that is used to determine if the file is a zip file. The first value is set to Current Data. The Comparison is set to Matches Regular Expression. The Second value is set as below.

Second Value: 
(?s)^PK\u0003\u0004.*

Decision Shape Set up

Figure 2. Decision Shape to determine if the file is a zip file.

Article originally posted at Boomi Community.

Published Apr 27, 2022

Developing a better world.© All rights reserved.