In article <
20160611181636.d070...@speakeasy.net>,
James K. Lowden <
jklo...@speakeasy.net> wrote:
>On Thu, 9 Jun 2016 19:57:08 +0000 (UTC)
>
gaz...@shell.xmission.com (Kenny McCormack) wrote:
>
>> >> Please don't suggest other tools (i.e., other than "cp").
>> >
>> > Rsync's 'dir' vs 'dir/' syntax might just do exactly what you want
>> > in this situation.
>>
>> I know that newsgroup types think that rsync is the cat's pajamas,
>> but I don't like it. It's way too complicated.
>
>I agree with you. To copy trees, I long ago adopted pax(1). Its
>syntax is almost exactly like cp, and it has the benefit of retaining
>timestamps (and, if need be, ownership).
So does "cp" when you use the "-a" option.
>Your syntax would be:
> # mount /dev/sdb1 /mnt/test
> # cd /dev/sdb1
^^^^^^^^^
I doubt that line is correct. I think you mean "cd /"
(or, more generally, cd to your source directory)
> # pax -rw . /mnt/test
>
>Learning pax saves you from dealing with tar, and from systems without
>GNU cp.
I've never really had the inclination to learn pax, but pax is, basically,
cpio in a pretty, modern, wrapper, right?
Long and far away, the first method I ever learned to do this was:
# cd source directory
# find . | cpio -pvadum /path/to/dest
This is nice because you can use the flexibility and power of "find" to
accurately specify which files to copy.
>> That is, funny ambiguity about whether or not to create a target
>> directory.
>
>The pax rule is there's no ambiguity: the target path is the source
>path. In simple cases, these are all the same:
>
> # pax -rw . /mnt/test
> # pax -rw ./ /mnt/test
> # pax -rw ./* /mnt/test
> # pax -rw * /mnt/test
>
>(There are options to transform the output filename; -s is much more
>powerful than "use the source path or not". But "cd to src" keeps
>things simple.)
Yeah, I get it, but I still kinda prefer the model of cd'ing to the
destination and copy "from there to here", rather than the alternative of
copying "from here to there".
>There are good reasons not to use wildcards, though:
Agreed. No need to sell me on this.
But note that the *real* issue here is the "x" (in cp -avx).
Does pax have that functionality? If not, then it is a non-starter.
Note that "find" has "-xdev".
--
Modern Conservative: Someone who can take time out from flashing her
wedding ring around and bragging about her honeymoon to complain that a
fellow secretary who keeps a picture of her girlfriend on her desk is
"flauting her sexuality" and "forcing her lifestyle down our throats".