sftp-deploy - Avoid rename existing files

Thomas Kiesl
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 1, 2024

Hello all, in case that the same file already exists on the destination system is overrides it. Is there a way to avoid overriding or better to automatically rename the file. The existing file on the destination system should stay untouched.

1 answer

1 vote
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 2, 2024

Hello @Thomas Kiesl ,

thank you for reaching out to the Community!

The STFP tool will simply upload your files and overwrite any existing file with the same name in the destination. Unfortunately, the sftp tool itself does not currently provide any option/flag to keep a copy of the replaced files.

If you are looking to have a backup of the existing files prior to replacing them, or if you want to ignore the transfer of existing files in the remote end, I would suggest using the rsync pipe instead.

Rsync will provide you with flags where you can achieve the behavior you are looking for:

For those flags to be taken into account while using the rsync pipe you will need to provide them as part of the EXTRA_ARGS variable in the pipe's definition.

You can explore all the available flags for rsync on its manual page below : 

Hope that helps! Should you have any questions, feel free to ask.

Thank you, @Thomas Kiesl !

Patrik S

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events