Using Zip Writer snap without file structure

I am trying to use a Zip Writer snap zip a .txt file to become .zip file.
So if my txt file location is /intshare/test/watermarkout//test.txt, when I zip it, the folder structure comes with the zip.

Here is my snap

and when I unzip it, it has folder structure

How do I not include the folder structure with the zip file? I just want file test.txt in the root of the zip.


Use a mapper with binary output before ZipFile writer snap and map the content-location of your file:
['content-location'].substr([‘content-location’].lastIndexOf("/") + 1) ----> $[‘content-location’]

Then in the zip file write, just enter the filename of the archive folder



Thank you @j.angelevski
It is working great.

@j.angelevski So I did tried this and it looks like it zipped all the files together in 1 zip file.
Is there a way to have each input file its own zip file?

For example, my input are test1.txt and test2.txt. I like to be able to produce 2 zip files. and


Zip File Writer puts all binary input files into one zipped file, a workaround for this I think it would be if you create a child pipeline with binary input and in that pipeline put the Zip File Writer snap.

Here I use a MultiFile Reader.

The configuration of the mapper stays the same. But now instead of using a zip file writer you use a pipeline execute to execute the child pipeline. The configuration of the pipeline execute is really straightforward, just choose the child pipeline and pass the ‘count’ parameter with a value ‘’, this function counts the number of input documents.

Then in the child pipeline just add the zip file writer snap.
Here ‘_count’ refers to the parameter passed from the parent pipeline.

Result would be:

This will create x number of zip files for every input document.

Hope this answers your question.