UNZIP password required files

#1

How could we unzip password required files?

0 Likes

#2

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

#3

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

0 Likes

#4

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

#5

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

0 Likes

#6

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?

0 Likes

#7

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.

0 Likes

#8

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.

0 Likes

#9

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

0 Likes

#10

Hi there,

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

Br,
Ivan

0 Likes