Hi how do I copy a folder from source to destination in Ubuntu without replacing the existing contents in the destination folder?
cp -r -u and
cp -r -n, and neither one worked.
I believe that if you're copying a directory using -r, the -n will only take effect against the directory being copied, not individual files, leaving you with -i which is interactive though, which means you have to stick around to watch it go. Not useful if you're scripting I suppose.
What can work instead if you're copying a source which has multiple directories within, is
rsync with the
--ignore-existing flag. rsync can also work for local transfer, in fact, I prefer it for copying entire directory/subdir's..
cp -i for interactive queries before overwriting. You can find more with