in Education by
I have connected to my remote server via FTP and i put some zip file using following code. channelSftp.cd(SFTPWORKINGDIR + "/" + remoteDestinationDir); File file = new File(localSourceToFile); LOG.info("Transferring file: " + localSourceToFile + " to "+ SFTPWORKINGDIR + "/" + remoteDestinationDir); FileInputStream fis = new FileInputStream(file); channelSftp.put(fis, file.getName()); fis.close(); LOG.info("Transfer successful"); Now, I want to unzip file on server JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
It seems that ChannelSftp doesn't support executing commands on the server side. It mainly deals with the transfer of files. You can use ChannelExec https://epaul.github.io/jsch-documentation/simple.javadoc/com/jcraft/jsch/ChannelExec.html to execute unzip /path/to/uploaded/file.zip. Alternatively, you could have a job running on the server side which watches the directory you upload files to and upzip any uploaded zip-files automatically.

Related questions

0 votes
    I have been looking at using the ssh2 module for sftp shipping of logs. However the cloud service hosting ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 18, 2022 in Education by JackTerrance
0 votes
    SFTP is abbreviated as ________ (a) Secure File Transfer Protocol (b) Secured File Transfer Protocol (c) Secure Folder ... questions and answers pdf, mcq on Cyber Security pdf,...
asked Nov 5, 2021 in Education by JackTerrance
0 votes
    Which of the following is the port number for SFTP service? (a) 21 (b) 22 (c) 23 (d) 69 I have been ... bank, Cyber Security questions and answers pdf, mcq on Cyber Security pdf,...
asked Nov 4, 2021 in Education by JackTerrance
0 votes
    Can we use ASCII or Binary Transfer mode in SFTP connection?...
asked Mar 18, 2021 in Technology by JackTerrance
0 votes
    Write a program which sends the name of a text file from the client to server and display the message on the ... file present or not. Select the correct answer from above options...
asked Dec 1, 2021 in Education by JackTerrance
0 votes
    What is Amazon FSx for Windows File Server?...
asked Feb 11, 2023 in Technology by JackTerrance
0 votes
    In the transfer of file between server and client, if the transmission rates along the path is 10Mbps, 20Mbps, 30Mbps, ... ___________. A. 20Mbps B. 10Mbps C. 40Mbps D. 50Mbps...
asked Jan 8, 2023 in Technology by JackTerrance
0 votes
    I have a series of files on a private ftp file server that I am trying to download using mechanize ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 28, 2022 in Education by JackTerrance
0 votes
    Which utilities can we use to export data from sql server to a text file? (a) DTS export wizard ( ... Answers, Database Interview Questions and Answers for Freshers and Experience...
asked Oct 11, 2021 in Education by JackTerrance
0 votes
    In _________ model, the configuration server automatically sends the updated configuration file if there is any change. 1. Both the options 2. Push 3. Pull...
asked Sep 18, 2021 in Technology by JackTerrance
0 votes
    I'm trying to use the mail() function on my computer so I can test the web application's system ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 30, 2022 in Education by JackTerrance
0 votes
    I need to check if url exists and can be reached. In order to do it I send Get request and ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 23, 2022 in Education by JackTerrance
0 votes
    I would like to get the exit code of my remote command. It's normally pretty easy, but I need ... -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null ubuntu@$ip_server bash...
asked Jun 1, 2022 in Education by JackTerrance
0 votes
    I am trying to create a pluggable database and am executing commands through sqldeveloper. For enabling the ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 22, 2022 in Education by JackTerrance
...