1
votes

I am using spring integration to pull files from remote sftp server. One requirement is that after pulling file from remote server directory (into local), it is needed to archive a copy of the pulled file into a different directory on same sftp server.

I checked the different options here. There are file synchronization or file copy options to local. But didn't find an option for remote.

Should I try something else other than spring integration? I'm using spring integration because it is already part of app. This is a new requirement.

1

1 Answers

2
votes

For that purpose you should consider to use SftpOutboundGateway with the Command.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.