Linux how to copy but not overwrite? [closed] Linux how to copy but not overwrite? [closed] linux linux

Linux how to copy but not overwrite? [closed]


Taken from the man page:

-n, --no-clobber              do not overwrite an existing file (overrides a previous -i option)

Example:

cp -n myoldfile.txt mycopiedfile.txt


Consider using rsync.

rsync -a -v --ignore-existing src dst

As per comments rsync -a -v src dst is not correct because it will update existing files.


cp -n

Is what you want. See the man page.