我一直在使用 sshj 库
<dependency>
<groupId>net.schmizz</groupId>
<artifactId>sshj</artifactId>
<version>0.3.1</version>
</dependency>
以下是我使用 0.3.1 的代码,它可以很好地上传支持通配符模式的文件。
SSHClient client = null;
SCPUploadClient uploader = null;
try {
client = getClient();
uploader = client.newSCPFileTransfer().newSCPUploadClient();
uploader.setFileFilter(new WildcardFileFilter(wildCardPattern));
//determine the remote directory
File f = new File(localDirLocation);
String dir = remoteDirLocation + f.getName();
uploader.copy(localDirLocation, remoteDirLocation);
} catch (IOException e) {
//processing exceptions here
} finally {
disconnectClient(client);
}
但是现在,当我尝试迁移到 0.5.0 时,代码给了我很多编译错误。
当我想将文件从本地上传和下载到远程机器时,我想了解如何设置文件过滤器,反之亦然
有人可以帮我吗?