My basic problem is that when I am doing a "mass copy" - that is copying a 
large directory
structure from one place to another, most of the time I want behavior #1 from 
the list
below, but, occasionally, I want behavior #2.

1) If the original directory is, say, /foo/bar/beezle and my current directory 
is
/home/wow, then I want the contents of /foo/bar/beezle to be copied into 
/home/wow.  E.g.,
if there is a file called /foo/bar/beezle/zowie, the new file will be: 
/home/wow/zowie.

2) Same setup as before, now I want it to create a new directory "beezle" under 
/home/wow
and then put all the copied stuff there.  So, in the example above, the new 
file would be:
/home/wow/beezle/zowie.

Now, the two programs that I use to do these sorts of copies are "cp" and 
"rsync".  I'm
pretty sure that "rsync" does one thing if you do something like:

    $ rsync -avxH /foo/bar/beezle .

And the other if you do:

    $ rsync -avxH /foo/bar/beezle/ .

But I can never remember which is which, so I usually end up trial-and-erroring 
it until I
get it right.

But, here's the thing, "cp" (with -a) seems to do the same thing with either 
syntax, which
is behavior #2 from the above list (which is usually, IME, the wrong thing).

Interestingly, after a little bit of trial-and-error, I found that:

    $ cp -a /foo/bar/beezle/. .

does the right thing.  But it seems like there should be a cleaner solution.  
Is there?

Note, incidentally, that another method would be:

    $ cp -a /foo/bar/beezle/* .

But that would miss the "dot files", wouldn't it?

=================================================================================
Please do not send me replies to my posts on the list.
I always read the replies via the web archive, so CC'ing to me is unnecessary.

When responding to my posts, please try to refrain from giving bureaucratic 
answers.
If you have nothing useful to say, then just click Next and go on.

Reply via email to