Spring Integration-SFTP:从一个远程目录复制到另一个远程目录

Spring Integration-SFTP: Copy from one remote directory to another remote directory

我正在使用 spring 集成从远程 sftp 服务器中提取文件。一个要求是从远程服务器目录(到本地)拉取文件后,需要将拉取文件的副本存档到同一 sftp 服务器上的不同目录中。

我检查了不同的选项 here。有文件同步或文件复制选项到本地。但是没有找到远程的选项。

我是否应该尝试 spring 集成以外的其他方法?我正在使用 spring 集成,因为它已经是应用程序的一部分。这是新要求。

为此,您应该考虑将 SftpOutboundGatewayCommand.MV 一起使用:https://docs.spring.io/spring-integration/docs/5.0.3.RELEASE/reference/html/sftp.html#sftp-outbound-gateway

The mv command has no options.

The expression attribute defines the "from" path and the rename-expression attribute defines the "to" path. By default, the rename-expression is headers['file_renameTo']. This expression must not evaluate to null, or an empty String. If necessary, any remote directories needed will be created. The payload of the result message is Boolean.TRUE. The original remote directory is provided in the file_remoteDirectory header, and the filename is provided in the file_remoteFile header. The new path is in the file_renameTo header.