It always seemed like the recursive flag of cp was an implementation detail leaking into the UI. Like, I get that copying a file requires creating more than one inode, but...so? Eventually, graphical OSes agree with me—copy/paste works the same on folders as it does on files.
It's rather sad that none of the answers were that the cp command simply did not gain a recursive option until the 1980s, well into the 1980s if you were on one side of the Unix wars.
Yes, seriously. When you read about the supposed evils of cat -v from the Unix nostalgia people, remember that it was the same people who gave cat its -v option who also gave cp its -r option, in 4.2BSD.
It took over half a decade to percolate out of the BSD world, too. AT&T Unix System 5 did not have an -r option to cp. Here's Brandon S. Allbery explaining in 1987 how one copies directories on AT&T Unix System 5 Releases 2/3 by combining find and cpio -p:
You know, when I came into Unix in the 1990s we still didn't care about recursive copy, because all admins learned the standard idiom to copy over a hierarchy:
tar cf - . | ( cd /new/path; tar xpf - )
or thereabouts, because at the time, `tar` was more than capable of doing all the filesystem tricks that `cp` was clumsy with, and we understood this idiom well. You could also `dump` an entire block device.
I believe that my motivation was that the Unix wars were still raging hotly; as a sysadmin I needed portable skills and I wasn't tied or certified to one vendor's Unix, and therefore I sought out idioms that worked on SunOS, HP/UX, AIX, BSD, you name it. "cp -r" didn't enjoy that stable support at the time.
drhagen · · focus · HN ↗
dotancohen · · focus · HN ↗
<a href="https://unix.stackexchange.com/questions/82485/when-wouldnt-one-want-cp-to-be-recursive" rel="nofollow">https://unix.stackexchange.com/questions/82485/when-wouldnt-...
It seems that recursive by default would have been much more intuitive.
JdeBP · · focus · HN ↗
Yes, seriously. When you read about the supposed evils of cat -v from the Unix nostalgia people, remember that it was the same people who gave cat its -v option who also gave cp its -r option, in 4.2BSD.
It took over half a decade to percolate out of the BSD world, too. AT&T Unix System 5 did not have an -r option to cp. Here's Brandon S. Allbery explaining in 1987 how one copies directories on AT&T Unix System 5 Releases 2/3 by combining find and cpio -p:
* <a href="https://groups.google.com/g/comp.unix.questions/c/XiumTgkcYRE/m/kJwkU5SlOasJ" rel="nofollow">https://groups.google.com/g/comp.unix.questions/c/XiumTgkcYR...
Originally we read directories as raw byte streams and liked it, you know. (-:
ButlerianJihad · · focus · HN ↗
I believe that my motivation was that the Unix wars were still raging hotly; as a sysadmin I needed portable skills and I wasn't tied or certified to one vendor's Unix, and therefore I sought out idioms that worked on SunOS, HP/UX, AIX, BSD, you name it. "cp -r" didn't enjoy that stable support at the time.
JdeBP · · focus · HN ↗
I use pax -r -w most of the time.