Skip to content

SFTP: Failed to transfer file if temporary remote directory doesn't exist #9684

Closed
@sottaviani2

Description

@sottaviani2

5.5.20

Describe the bug
I use SftpMessageHandler to send files to a remote SFTP server.
I want to transfer files using a temporary remote directory. Transfer is aborted if the temporary remote doesn't exist, otherwise it works fine.

To Reproduce
Transfer file test.txt to /remote setting /remote_temp as temporary directory. /remote_temp doesn't exist on target server

Expected behavior
If /remote_temp doesn't exist on remote server and autoCreateDirectory is true, the file is sent to /remote and /remote_temp is created to store the file before moving to final destination.

Sample
SftpMessageHandler handler = new SftpMessageHandler(sftpSessionFactory) ;
handler.setRemoteDirectoryExpressionString("headers['remoteDirectory']");
handler.setTemporaryRemoteDirectoryExpressionString("headers['remoteTempDirectory']");
handler.setAutoCreateDirectory(true);

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions