[CentOS] scp -rp behavior

Fri Feb 27 01:15:23 UTC 2015
Richard <lists-centos at listmail.innovate.net>


------------ Original Message ------------
> Date: Thursday, February 26, 2015 18:45:34 -0600
> From: Valeri Galtsev <galtsev at kicp.uchicago.edu>
> To: CentOS mailing list <centos at centos.org>
> Subject: Re: [CentOS] scp -rp behavior
>
> 
> On Thu, February 26, 2015 6:34 pm, Mark LaPierre wrote:
>> Hey all,
>> 
>> I'm trying to copy configuration files from my old CentOS 6.6 32
>> bit machine to my new CentOS 6.6 64 bit machine.
>> 
>> On my 32 bit machine:
>> 
>> [mlapier at mushroom ~]$ ifconfig
>> eth0      Link encap:Ethernet  HWaddr 00:19:DB:E5:4E:9F
>>           inet addr:192.168.15.105
>> 
>> When I issue this command on my new 64 bit machine,
>> 192.168.15.101:
>> 
>> scp -pr mlapier at 192.168.15.105: /home/mlapier/.thunderbird
>> /home/mlapier/.thunderbird
> 
> How about escaping dot (with backslash) for the remote machine, or
> just giving the whole path for remote machine in quotes:
> 
> scp -pr mlapier at 192.168.15.105:"/home/mlapier/.thunderbird"
> /home/mlapier
> 
> ?
> 
> Also, if you want to specify destination directory (say with
> different name) you will need to end directory with forward slash
> both on local and remote, like:
> 
> scp -pr mlapier at 192.168.15.105:"/home/mlapier/.thunderbird/" \
> /home/mlapier/.thunderbird/
> 
> (this should be one line which didn't fit for me in one line hence
> backslash...)
> 
> Valeri
> 
>> 
>> It copies all directories and files in 192.168.15.105:
>> /home/mlapier/ to 192.168.15.101: /home/mlapier.  I don't want
>> all that, I just want the .thunderbird folder and all it's
>> contents.
>> 
>> The user and group account numbers match on the two machines for
>> this user so that's not the issue.
>> 
>> When I RTFM this is what I thought it said to do.  I'm I
>> misreading the FM or is something weird going on here?
>> 

As I believe was suggested by someone when you asked about this a
few days ago, the space that you have after the colon:

  scp -pr mlapier at 192.168.15.105: /home/m...

is the source of your problem. I just tested and confirmed it.

Some other notes: with the "mlapier at 192.168.15.105" you'll, by
default, be "in" the home directory of mlapier on the remote
machine. So you don't need the "...:/home/mlapier/" pathing. Also,
if you are in your (mlapier) home directory on the new machine when
you are doing this you again won't need the pathing.

So, I think you should be able to do just:

   scp -pr mlapier at 192.168.15.105:.thunderbird .

or at most:

   scp -pr mlapier at 192.168.15.105:.thunderbird /home/mlapier/.
   
If, per chance, you wanted to change the directory name on the
transfer you'd need to specify it, rather than just the ".",
otherwise the "." will simply put directory on the target machine
with the same name as the original.



   - Richard