[英]Transfer file from SFTP server to the local system using Java
I am using the JSch library. 我正在使用JSch库。
I need three methods: 我需要三种方法:
void delete()
--- to delete the file with the given name void delete()
---删除具有给定名称的文件 void copy()
--- to copy the file with the given name into the local system void copy()
---将具有给定名称的文件复制到本地系统 list copyndelete()
--- to copy the file and to delete the file in the remote system ... and also return the name of the file deleted into the list. list copyndelete()
---复制文件并删除远程系统中的文件...,并将返回的文件名返回到列表中。 How could I do this? 我该怎么办?
您可以尝试使用Apache FTPSClient 。
Try using Jcraft . 尝试使用Jcraft。 Its an Open source Project 它是一个开源项目
The JSch library contains the ChannelSftp class. JSch库包含ChannelSftp类。 This class has (between others) also methods to 此类(其他之间)还具有以下方法
get
methods) 将远程文件复制到本地文件(所有get
方法) rm
method, or rmdir
to delete empty directories) 删除远程文件( rm
方法或rmdir
删除空目录) ls
) 列出远程文件( ls
) All your requirements can be fulfilled from combinations of these methods. 这些方法的组合可以满足您的所有要求。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.