Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Question concerning remote tar

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hello everyone, I hope I can get an answer to this. I am looking at doing a remote tar from one system to another. The reason for doing so is to keep the permissions, ownership, and group the same as it is on the original system ....... say I have a directory called /opt/java and I'm wanting to put it on another machine under /home/lmgrif2/java (just as an example) would the following command be correct?

First of all, I would have to be in the /opt file system/directory before doing this command on the original machine ...

tar cvf - java|remsh (machine name copying files to) "cd /home/lmgrif2/; tar xvf -"

Thanks in advance, just making sure I have the right command.

LG
 
Hi
Here is another command that will do it same as you like even faster.

#cd /opt/java
#find . | cpio -o |remsh remotesystem "cd /home/imgrif2/java/ ; cpio -idmuv"

How does this work?
find . will find everything under java direcory and pass it to cpio command it will then pass it to remsh command and where it does cd to your destination dir and will create all recursive directory and keep permmission, ownership (-idmuv) and will create necessary directory.


Patel
 
Thanks Patel, I wound up using the remote tar command instead ....... forgot to post back out here about it. I will definitely keep your command in my "little book of notes" as well.

BTW, the remote tar that I did worked

cd /opt
tar cvf - java|remsh (remote machine) "cd /home/lmgrif2/; tar xvf -"

Thanks again Patel!!! Always good to have more than one option when dealing on the command line in UNIX! :)

LG
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top