Linux: Copying from one folder to another without overwriting any existing files
Here are a few tricks on how to copy files in linux from one location to another whilst not overwriting any files.
Using GNU Copy (which is not included in all distributions) you can simple use the -n (--no-clobber) option like follows:
cp -n /source /target
But, if you happen not to be using GNU copy, a nice little trick I found is to do the following:
yes n | cp -i /source /target
As you can see - I'm simply piping an n into the cp command to tell it not to overwrite any files.
Another option is to use RSYNC, example as follows:
rsync -r -ignore-existing /source/. /target/.