1846551 Members
1716 Online
110256 Solutions
New Discussion

rcp command

 
Ron Bromwell
Frequent Advisor

rcp command

If I use the rcp with the -r and -p options to copy files from one machine to another, will I also get any soft links carried over to the new machine. If not is there an option to also copy the soft links over.
Thanks,
Ron
life's a journey, not a destination
7 REPLIES 7
Uday_S_Ankolekar
Honored Contributor

Re: rcp command

Hi,

rcp -rp will keep permissions, owner, Time stamp intact while copying over., but not guarantee about soft links

-USA
Good Luck..
Jeff Machols
Esteemed Contributor

Re: rcp command

Ron,

The links will be copied as files. if you want to preserve links, you will have to use tar
Sridhar Bhaskarla
Honored Contributor

Re: rcp command

Unforunately, -r will replace the softlink with the file. So, it's better not to use -r with rcp if you have softlinks.

One way I can think of is to tar up the files, rcp the bundle and then untar using remsh command. This will restore softlinks as well the permissions.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Santosh Nair_1
Honored Contributor

Re: rcp command

Adding to Shridar's suggestion, you could use a combination of tar and rsh, i.e:

tar cpf - |remsh "cd |tar xvpf -"

Hope this helps.

-Santosh
Life is what's happening while you're busy making other plans
Anthony deRito
Respected Contributor

Re: rcp command

cpio is the command you should use to retain links, ownership and permissions.

#cd dir
#find . -depth | cpio -ocB | remsh "cd ; cpio -imdvcB"

Tony
Roger Baptiste
Honored Contributor

Re: rcp command

hi,

Another suggestion:

find | cpio -ov | compress - | remsh '(cd /;uncompress - | cpio -ivmud)'


HTH
raj
Take it easy.
Sachin Patel
Honored Contributor

Re: rcp command

I think rdist copy links.

Sachin
Is photography a hobby or another way to spend $