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.
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 therename-expression
attribute defines the "to" path. By default, therename-expression
isheaders['file_renameTo']
. This expression must not evaluate to null, or an emptyString
. If necessary, any remote directories needed will be created. The payload of the result message isBoolean.TRUE
. The original remote directory is provided in thefile_remoteDirectory
header, and the filename is provided in thefile_remoteFile
header. The new path is in thefile_renameTo
header.