Help uploading zip file to sftp site

Hello,
I need to zip a .CVS file and upload it to an SFTP site.
However, the SFTP site requires a certain file format and will not accept the “location column” required by the zip files node.
Is there a way to specify which columns to include/exclude when zipping the file or when uploading the file to the SFTP site (in the string to URI or upload nodes)? Also, is there a way to zip the file and upload it all in one workflow? The zip files node doesn’t have an output port.
Please forgive me if all this is obvious and I’m missing it. I am new to Knime and this is my first attempt at a file transfer workflow.
Any help is appreciated, Thanks!

zip%20file%20to%20sftp%20site

1 Like

Use column filter node after CSV reader.


And connect Zip Files node with File Reader using flow variable port.

1 Like

The zip files node uses the ‘location column’ as the path to the file to zip. If I exclude it using the column filter it can’t find the file to zip.
Also, can you be more specific about the ‘flow variable port’, I did some research and I’m not understanding which one to use.
Thanks!

Hi there @Cal!

Zip Files node doesn’t need data to be read into KNIME so you do not have to read your data from csv file. Instead provide its folder location and node will create zip file out of all files from that folder.

I have created an example workflow so take a look. Csv files are in data folder within workflow and zip file is created in output folder also within workflow. For reading and writing files I’m using workflow relative paths.

Here is workflow attached. If any questions feel free to ask.
2019_06_17_zip&upload.knwf (22.0 KB)

Br,
Ivan

3 Likes

Hi ipazin,
Thanks so much for your post! This definitely works. I will do the “Flow variables : Creation & Usage” tutorial to learn more. I see where you used a join function to append the data folder to the workflow.absolute-path in the String Manipulation node. Just curious, is it possible to define a path there that is not “in relative workflow” (example: C:\Users\username\Documents\projects\data)? Or does the “data” folder have to reside inside the workflow folder? Hopefully that makes sense.
Thanks again!

Hi,

There is also this blog post to read more about Flow Variables:
https://blog.statinfer.com/knime-spirits-at-your-service/

:blush:

2 Likes

Hi @Cal,

glad it helped.

Regarding data and output folders and relative paths. That is my way of working for example workflows uploaded to forum. This way when you (or someone else) downloads workflow, one can be executed without need to change anything. So to answer your question data folder doesn’t have to reside inside workflow folder.

For your use case you can use Table Creator node (instead the first 4 nodes I used) and there in URI type column write your path (file:/C:/Users/username/Documents/projects/data/) and connect it to Zip Files node.

Br,
Ivan

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.