4 Replies Latest reply: Jul 31, 2012 2:24 AM by gimbal2 RSS

    Question on JSCH

    909741
      hi,

      I need to create the zip file in the remote directory, the files are available under the directory and i need to create the zip file in the same directory it is containing all files in the directory.

      I am using jsch, to access the remote directory.

      Can anybody help, how to do this using jsch.
        • 1. Re: Question on JSCH
          rp0428
          >
          Can anybody help, how to do this using jsch.
          >
          Help with what? How to use jsch, or how to create a zip file? This isn't a coding service.

          For help with jsch you need to go to the JCraft website
          http://www.jcraft.com/jsch/

          For help creating a zip file search the web. There are plenty of examples there. Here is one to get you started.
          http://www.avajava.com/tutorials/lessons/how-do-i-zip-a-directory-and-all-its-contents.html
          • 2. Re: Question on JSCH
            909741
            Thanks for the reply, i am aware of how to do it in local machine, i need to know how to do the zipping in remote machine using JSCH.
            • 3. Re: Question on JSCH
              rp0428
              >
              Thanks for the reply, i am aware of how to do it in local machine, i need to know how to do the zipping in remote machine using JSCH.
              >
              Well then I don't understand what your question is.

              JSCH gives you access to files on a remote machine.

              The steps to create a zip is to:

              1. Create a new ZipOutputStream
              2. iterate through each file/directory in a folder.
              3. add a zipentry for each file/directory to the output stream
              4. Close the output stream

              It doesn't make any difference where the source files are located or where the target zip file is created.

              What is it you are having trouble with?
              • 4. Re: Question on JSCH
                gimbal2
                906738 wrote:
                Thanks for the reply, i am aware of how to do it in local machine, i need to know how to do the zipping in remote machine using JSCH.
                JSCH helps you to create a connection through SFTP. It isn't built to help you fulfill every requirement you have. So stop thinking that you have to do it with JSCH - NO. You create the connection to the SFTP server through JSCH - when you have that, what then?