cp -Rin OpenBSD and it has the normal behaviour. I would say FreeBSDs behaviour is new, and perhaps from GNU.
Probably also because there are a few different "strains" of Unix. There's the obvious BSD one we all know and love. Another big one was System V. Plus a bunch of variants that used a combination of BSD and System V. And then there's GNU; the acronym should tell you enough; GNU's Not Unix.it seems there is no true Unix-like behavior for cp in recursive form
What do you think is 'normal'? I consider the behavior on FreeBSD to be normal and everything else strange.
cp -R dir/ dir2is: for doing
cp -R dir dir2I normally use shell completion, but then I must delete the slash, otherwise dir2 gets trashed.
cp -R dir/ dir2is not necessary, one just does
cp -R dir/* dir2and so is better: one explicitly writes what one wants.
dir and dir/ represent the same directory and should be treated indifferently.
FreeBSDs cp -R dir/ dir2 is not necessary, one just does cp -R dir/* dir2 and so is better: one explicitly writes what one wants.
cp -R dir/ dir2.
Perhaps one day FreeBSD will be like a linux distribution.
mv /a/b/ foo
mv /a/b/ /a
/a/b/, if b were a symlink, would do a wildcard move/copy of the files to where b points to. I now understand your frustration because I see a tiny inconsistency, so I don't know why the design decision to do
/a/b/*if b is a directory. Hopefully a FreeBSD veteran in the community could shed some light here.
Reaction score: 892
-R If source_file designates a directory, cp copies the directory and the entire subtree connected at that point. If the source_file ends in a /, the contents of the directory are copied rather than the directory itself. This option also causes symbolic links to be copied, rather than indirected through, and for cp to create spe- cial files rather than copying them as normal files. Created di- rectories have the same mode as the corresponding source directory, unmodified by the process' umask.