directory copying with cp; broken?
Wayne Mesard
mesard at bbn.com
Thu Oct 6 00:36:30 AEST 1988
Note Followup-To.
>From article <40 at ausonics.OZ>, by greyham at ausonics.OZ (Greyham Stoney):
> in article <8540 at smoke.ARPA>, gwyn at smoke.ARPA (Doug Gwyn ) says:
>> "cp" is not changing anything; it's making a copy of the contents of a
>> file. It wouldn't be safe for that to be turned into an actual
>> directory since at least the "." entry in it would be incorrect.
>
> Minor semantic point. Come on, you know what I was getting at. No, I wasn't
> proposing it should create a directory, but rather that it made more sense to
> reject the copy (or just copy the directory contents and do away with the -r
> flag). Just depends on how you look at it I guess.
> Greyham
Indeed. And more generally, a consistent way of handling directories
(i.e. directory files) needs to be established. In SunOS 3.4:
cp <dir> <fn> ==> "cp: <dir>: Is a directory (not copied).
head, tail, cat <dir> ==> {works}
more <dir> ==> "*** <dir>: directory ***"
My preference is for cp to do the right thing (i.e, nix the -r flag) and
for cat, head and tail (and any other file display* programs) to behave
as more(1) does, with the addition of a new option to cat(1) to
explicitly tell it to treat a directory as an ordinary file.
But that's just one opinion.
* It would be silly to remove functionality from file _processing_
programs such as wc.
--
void *Wayne_Mesard(); MESARD at BBN.COM BBN, Cambridge, MA
More information about the Comp.unix.wizards
mailing list