A request for cp flag
David Demelier
demelier.david at gmail.com
Mon Oct 17 15:40:27 UTC 2016
Le 17 oct. 2016 4:50 PM, "Manish Jain" <bourne.identity at hotmail.com> a
écrit :
> I occasionally face a problem while copying contents with cp. The -R
> flag of cp takes the source name as this : If the source_file ends in a
> /, the contents of the directory are copied rather than the directory
> itself.
This is by design, rsync does the same.
> Now, I am pretty sure, there must be good reasons for cp to behave in
> that manner by default. But it also creates significant opportunities
> for things to go wrong the way shell completion of directory names works.
>
> Could it considered a valid request that an extra flag (perhaps -r) be
> implemented that does the reverse : copy out src rather than src/* ?
This adds complexity, we will then need to explain carefully the difference
between the two options and then remember which of -r or -R copy the
directory itself and not the content.
And you can still get in trouble if typing too fast and accidentally write
cp -r instead of -R.
--
David Demelier
More information about the freebsd-questions
mailing list