【发布时间】:2016-07-21 11:43:33
【问题描述】:
我正在尝试使用本地目录同步 FTP 文件夹。这个 FTP 服务器在 z/OS 上运行,它是一个带有 MVS 操作系统的大型机。
到目前为止,我什至无法连接到我需要的文件夹,因为这个系统没有“正常”的文件夹系统。
这就是我为了更改文件所在的工作目录所做的:
public class DefaultFtpHostSessionFactory extends DefaultFtpSessionFactory {
protected void postProcessClientAfterConnect(FTPClient ftp) throws IOException {
ftp.changeToParentDirectory();
ftp.changeWorkingDirectory("E377D.");
}
}
现在我已经定义了一个输入通道适配器:
<int-ftp:inbound-channel-adapter
id="ljFtpInbound"
channel="ljFtpChannel"
session-factory="ljCachingSessionFactory"
auto-create-local-directory="true"
delete-remote-files="false"
filename-pattern="*"
remote-directory="*"
remote-file-separator=""
charset="UTF-8"
auto-startup="true"
preserve-timestamp="false"
local-filename-generator-expression="#this.toUpperCase()"
temporary-file-suffix=".writing"
local-directory="/tmp/">
<int:poller fixed-rate="1000" />
</int-ftp:inbound-channel-adapter>
您可以注意到远程目录是“*”,这是用于列出目录的,至少是我设法做到的唯一方法。
但是当 FtpInboundFileSynchronizer 尝试同步文件夹时,我得到一个错误,因为当它尝试复制文件时,路径是构建的:
String remoteFilePath = remoteDirectoryPath + remoteFileSeparator + remoteFileName;
在我的情况下是“ASTERISK”+“BLANK”+“REMOTE_FILE_NAME”,因为我必须使用“*”作为远程目录,所以它找不到文件。
¿你知道我是否不能设置远程目录(我尝试过但没有实现)吗?或者还有其他方法可以同步这个奇怪的 FTP 系统。
谢谢。
【问题讨论】: