Search code examples
scp

scp how to automatically overwrite files in destination without prompting


I use scp to upload files in a remote server. When the files already exist on the server I get a prompt like replace file? [y]es, [n]o, [A]ll, [N]one, [r]ename:

Due to the fact that I want to automate this procedure, I need to disable somehow this prompt, so there is no need for a middle man to answer the prompt and always overwrite the existing files.

Update: Actually the message was prompted by the uzip command I was using after I transfer the files. In order to automatically overwrite the files I did unzip -o name_of_zip_file.zip. But the rsync command is also better solution than the scp, because it also encypts and compress the data while transfering them, if you use the appropriate wildcards.


Solution

  • You can think of using Rsync, Complete reference can be found here