UNZIP password required files

How could we unzip password required files?

Hi @natashullea -

As you’ve noticed, the Unzip node doesn’t support use of passwords. So one workaround would be to use external software (I like the freely available 7zip) that you can call with the Bash node.

The Bash node is available in the KNIME NGS Tools extension. In this case, it can allow you to call out to 7zip using a command like (assuming Windows here):

cmd /c 7z x myfiles.zip -pmypassword

This syntax says:

  • Open a command window and close it when done
  • Within that window, execute 7zip to extract files from the archive “myfiles.zip”
  • Using a password “mypassword”

So, there are a few steps to deal with here, but ultimately it’s pretty simple to do. And importantly, it works! :slight_smile:

3 Likes

For one file it works… but when integrating the Bash node in a for loop it executes forever.

It sounds like the unzip command may be waiting on additional user input at the command line. Something like confirming if you want to overwrite an existing file.

Can you try the unzip operation manually from the command line and see if that’s the case? If so, there should be an additional option in 7zip to force operation. (I think it’s -ao or -y.)

Of course, if there’s an overwrite happening in the loop, you’ll want to be careful about whether that’s something you actually intend.

2 Likes

One question more… Could we disable logging of cmd command executing inside of Batch Node?

I’m not sure I understand the question. What logging are you referring to? Do you mean the output to stdout from the top port of the Bash node, or something else?

No, the logs that are logged during execution of the knime in Batch mode, for example: INFO KNIME-Worker-1 BashNodeModel cmd: [cmd, /c, for, /R, , C:\Users*\data\1\input, %I, in, (*.zip), do, (7z, x, -aoa, -oC:\Users*\data\1\output, %I)], I don’t want this do be logged as far as sometimes this command contains password too.

Have you tried changing the Log File Log Level under KNIME -> Preferences -> KNIME from INFO to WARN (or ERROR)? This should suppress INFO messages, I believe.

It will suppress them but for all nodes. I need to suppress them only for this node.

Hi there,

don’t think there is a way to suppress logging for certain nodes while for others to leave it…

Br,
Ivan

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