create separate zip files

I have a directory with very large SDFiles and need to zip each one. The zip node takes all files from one location and creates from several files one zip file. This is not what I need, the result must be 20 SDFiles should give 20 zip files.

Help is appreciated,

Alex

Hi Alex,

have you considered to use a Chunk Loop Start / Loop End construct in combination with flow-variables (to control the the output-file name)?

I attached a workflow as an example!

Hope this helps,

Christian

 

 

Thanks, this works, but it writes the zip files to the directory KNIME_2.9.0. How can I control the output directory?

I changed the output file to E:\Registration\aak_TOCRIS\test\test.zip, and reset the variable. But this did not do the trick.

Alex

 

You can specifiy the output directory in the lower text-field of the zip node. the flow variable just controls the filename (upper text-field).


Cheers,

Christian

 

ERROR Zip Files Execute failed: File "D:\Program Files\KNIME_2.10.0\2.zip" exists, overwrite policy: "Abort"

Whatever I do, the workflow writes 0.zip, 1.zip, 2.zip to D:\Program Files\KNIME_2.10.0\2.zip

Alex

Did you specify the prefix directory correctly?

The error states, that your overwrite policy is on abort, this means the node stops execution if the file already exists.

The complete file-path is determined via "outputfile" which should be set via your flow-variable. Then you check "truncate prefix" and specify your prefix directory. So in the end it's "prefix directory/output file".

Christian

 

The truncate prefix relates to the directory inside the zip file and has nothing to do with the output directory, where the files will be written.

Sorry, maybe we are talking not of the same issue. I want to learn where I can define the output directory for the zip files. It would be also nice if one could choose a name for the zip files, i. AKOS1.zip, AKOS2.zip, etc. Presently I get only 0.zip, 1.zip, etc.

See enclosed picture.

Thanks,

Alex

 

 

 

 

 

If you want to specifiy the exakt name of the zip-file you simply have to adjust the value of the flow variable. You can for example convert the output of the chunk loop to a variabe using the "TableRow to Variable" node which you plugin after the Chunk Loop Start. Then you have to adjust the flow-variable settings of the "Zip File" node of course. You can modify this variable before you plug it into your "Zip Files" nodes with a "Java Edit Variable" node.

Does this help?!

 

 

Hi Christian

No this does not work.  As I mentioned before, the variable for "Prefix directory" in the node ZIP Files has nothing to do with the location of the output.

The variable for Output File has to be currentiteration otherwise one does not loop over the files. 

I see no way where to adjust the varibles differently.

I saw the nodes ziploopstart and ziploopend. I could not do anything with them.

Could you make a working workflow, or we close this issue.

Thanks for your help. I understand if you don't have the time.

Alex