Downloading files from an SFTP server using JSch

前端 未结 3 445
北恋
北恋 2020-12-15 22:17

I am using jsch to download files from server, my code below.

public static void downloadFile(TpcCredentialsDTO dto) {
        logger.trace(\"Entering downlo         


        
3条回答
  •  攒了一身酷
    2020-12-15 23:06

    I fixed in this way:

    Vector files = sftp.ls(remotePath);
    String remotePath = properties.getFtpPath();
    Vector files = sftp.ls(remotePath);
    
    for (ChannelSftp.LsEntry entry : files) {
    
        InputStream stream = sftp.get(remotePath + "/" + entry.getFilename());
        // Your business code here
    
    }
    

    Where remotePath is the remote SFTP folder name.

提交回复
热议问题