Prevent overwriting of files when using Scp [closed] Prevent overwriting of files when using Scp [closed] linux linux

Prevent overwriting of files when using Scp [closed]


rsync seems to be the solution to your problem. Here's an example I got from here:

rsync -avz foo:src/bar /data/tmp

The -a option will preserve permissions, directory structure, ownership, and symlinks. You can also specify any of those options individually as well.

-v and -z mean verbose and compress respectively. You don't really need them although -z is nice if you are copying large files.


I just found a simple hack. Mark the existing files as read-only.


rsync -avz --ignore-existing /source folder/* user@remoteserver:/dstfolder/

--ignore-existing will not overwrite the files on remote server or destination server*.