0

Below is code snippet. Unzipping of .zip folder is not happening... It doesnt through but if i look at folder, i dont see any changes

public void unzipfolder(ChannelExec channelExec, String destPath, String filename)
        throws JSchException, IOException {
    System.out.println(filename + " Unzipped started");
    channelExec.setCommand("unzip " + destPath + "/" + filename);
    // channelExec.setCommand("unzip " + filename + " -d /home/testftp");
    channelExec.connect();
    channelExec.run();
    System.out.println(filename + " Unzipped");
}
  • Javadoc of [`run()`](https://epaul.github.io/jsch-documentation/javadoc/com/jcraft/jsch/ChannelExec.html#run--): *"**not to be called by the application.** Runs the main data transfer loop."* – Andreas Oct 09 '20 at 05:15
  • 1
    Does this answer your question? [Command using ChannelExec not executed - Jsch](https://stackoverflow.com/q/47539582/5221149) – Andreas Oct 09 '20 at 05:17
  • @Andreas is right, your code is not correct. And you need to read the error output to find out what the problem is. And you will likely find that you have this very common problem: [Certain Unix commands fail with “… not found”, when executed through Java using JSch](https://stackoverflow.com/q/40021860/850848). – Martin Prikryl Oct 09 '20 at 06:00

0 Answers0