I want to use the default cp on my mac to copy a folder to another destination. I want it to overwrite the target. But if the target folder exists, cp copies the source into the target instead of overwriting it.
In GNU cp, there is --no-target-directory. The argument does not exist on Mac's cp.
I would prefer not to switch to GNU's cp because I do not know if it's as fast as Mac's builtin cp (or maybe it is? I have not tested it). Performance is important here.
I also would prefer not to switch because that just seems like an overkill solution. Mac's cp work for me. There's a guarantee that it's installed on every mac.
cpcommand describe the-Roption and appending the source folder name with/? Have you tried the-Rand/or-aoptions? (My MacOS Monterey has these, but I don't know if earlier versions do also) – Sotto Voce Jul 31 '22 at 12:42cpimplementation will have significant differences in speed. They have different options and choices on how to handle edge cases, but the speed of the differentcpimplementations is very unlikely to differ. – terdon Jul 31 '22 at 14:09