0

In order to help avoid generating errors, I need a way to stop an automated scp script to stop from overwriting files if they are already present on the remote folder, and just do nothing instead.

Is this possible?

Jakuje
  • 6,813
Anon
  • 12,389

2 Answers2

1

No. It is not possible. SCP is simple tool and automatically overwrites files in destination. You will probably need to put together some rsync command to achieve that.

Jakuje
  • 6,813
1

No, that is not possible with scp. The easiest way to do this would probably be using rsync with the --ignore-existing option, as detailed here:

rsync --ignore-existing somefile somehost:/some/path/
rsync -r --ignore-existing somedir somehost:/some/path/

Note that this will not make rsync exit if a file already exists; it will just skip it and keep copying.