sftp

Sharpssh directory listing

感情迁移 提交于 2020-01-13 10:43:08
问题 I'm writing an application that allows me to up- and download files from a remote server. I'm using sftp as my transfer protocol and i need to list all files and directory's into a listview. I'm using sharpssh for sftp. Can somebody point me into the right direction? Thanks in forward, Bas van Ooyen 回答1: Sftp sftp = new Sftp(serverUri.Host, userName, password); sftp.Connect(); //the foldername cannot be empty, or the listing will not show ArrayList res = sftp.GetFileList("/foldername");

Sharpssh directory listing

两盒软妹~` 提交于 2020-01-13 10:42:38
问题 I'm writing an application that allows me to up- and download files from a remote server. I'm using sftp as my transfer protocol and i need to list all files and directory's into a listview. I'm using sharpssh for sftp. Can somebody point me into the right direction? Thanks in forward, Bas van Ooyen 回答1: Sftp sftp = new Sftp(serverUri.Host, userName, password); sftp.Connect(); //the foldername cannot be empty, or the listing will not show ArrayList res = sftp.GetFileList("/foldername");

How to transfer a file using a proxy with JSch library

狂风中的少年 提交于 2020-01-13 02:53:07
问题 I want to transfer files to a remote location and I am bound to use a proxy server for that. I was able to connect to the FTP location via following command : sftp -o "ProxyCommand /usr/bin/nc -X connect -x <proxy_host>:<proxy_port> %h %p" username@ftp_server: But I want to automate this process of file transfer and I am using JSch for SFTP and snippet of code is below: String sourceFile = sourceDir + fileName; JSch jsch = new JSch(); int port = Integer.parseInt(getFtpPort()); Session session

Use JSch to put a file to the remote directory and if the directory does not exist, then create it

核能气质少年 提交于 2020-01-12 01:33:29
问题 I would like to copy a file to the remote directory using Jsch library and SFTP protocol. If the directory on the remote host does not exist, then create it. In the API doc, http://epaul.github.com/jsch-documentation/javadoc/, I noticed in the put method that there is a kind of "mode" but it is just the transfer mode: - the transfer mode, one of RESUME, APPEND, OVERWRITE. Is there an easy way to do this without having to write my own code to check the existence and then create a directory

Use JSch to put a file to the remote directory and if the directory does not exist, then create it

坚强是说给别人听的谎言 提交于 2020-01-12 01:33:06
问题 I would like to copy a file to the remote directory using Jsch library and SFTP protocol. If the directory on the remote host does not exist, then create it. In the API doc, http://epaul.github.com/jsch-documentation/javadoc/, I noticed in the put method that there is a kind of "mode" but it is just the transfer mode: - the transfer mode, one of RESUME, APPEND, OVERWRITE. Is there an easy way to do this without having to write my own code to check the existence and then create a directory

SFTP connection with FTPSClient is failing

二次信任 提交于 2020-01-11 08:00:30
问题 Below code I'm trying to connect SFTP host using FTPSClient . Instead of FTP client, I'm using FTPSClient to connect. But I'm facing issue to connect. public static void main(String[] args) throws SocketException, IOException { String host ="sftphost.com"; String user = "abc"; String pwd = "pwd" final FTPSClient ftp = new FTPSClient(); System.out.println("host:"+host); ftp.connect(host,22); int reply = ftp.getReplyCode(); ftp.login(user, pwd); } 回答1: FTPS is not SFTP. You cannot use Apache

Convert multiple SFTP command lines to a single line command line

人盡茶涼 提交于 2020-01-11 07:53:11
问题 How do I convert this EOF into a one line sftp command-line? sftp -v bheng@45.55.88.88 <<EOF mkdir /home/forge/web-app/public/backup/$HOSTNAME/$DATE put $path/* /home/forge/web-app/public/backup/$HOSTNAME/$DATE bye EOF 回答1: Your question has nothing to do with SFTP/ sftp . It's just a generic shell question. So use any method that a shell allows, for example (echo command1 && echo command2 && echo command3) | sftp ... 来源: https://stackoverflow.com/questions/43728892/convert-multiple-sftp

WinSCP - How to recognize if file was transferred successfully

浪尽此生 提交于 2020-01-11 07:40:12
问题 I'm using WinSCP to automatically upload files through SFTP. I have turned on debug log on level 1. Is it possible to find out if the file was uploaded successfully? Thank you. Part of log file: . 2012-08-30 15:30:06.539 File: "C:\files\file_20120830.gpg" . 2012-08-30 15:30:06.539 Copying "C:\files\file_20120830.gpg" to remote directory started. . 2012-08-30 15:30:06.539 Binary transfer mode selected. . 2012-08-30 15:30:06.539 Checking existence of file. > 2012-08-30 15:30:06.539 Type: SSH

How can I enable passive mode while using JSch as SFTP client?

坚强是说给别人听的谎言 提交于 2020-01-11 06:03:46
问题 I'm using JSch as SFTP client and now I need to enable passive mode because of some limitation of security. But I can not found a way to enable passive mode . Can somebody tell me how to do this? 回答1: "Passive mode" is a specialty of the FTP protocol. In normal FTP mode for each individual file the client listens on a port and the server has to connect to this. As many firewalls support only outgoing connections, there was added the passive mode - here the client connects to the server for

How can I enable passive mode while using JSch as SFTP client?

狂风中的少年 提交于 2020-01-11 06:03:19
问题 I'm using JSch as SFTP client and now I need to enable passive mode because of some limitation of security. But I can not found a way to enable passive mode . Can somebody tell me how to do this? 回答1: "Passive mode" is a specialty of the FTP protocol. In normal FTP mode for each individual file the client listens on a port and the server has to connect to this. As many firewalls support only outgoing connections, there was added the passive mode - here the client connects to the server for