copy folder to remote server

Steven W. Orr steveo at syslang.net
Thu Jul 31 03:17:39 UTC 2008


On Monday, Jul 21st 2008 at 10:07 -0000, quoth Mad Unix:

=><redhat-list at redhat.com>
=>Message-ID:
=>	<4d3f56c90807210707v54ab0f17rfd1b88069ad40dde at mail.gmail.com>
=>Content-Type: text/plain; charset=UTF-8
=>
=>I want to copy all the following files/folder/subfolders under
=>/usr/local/apache/htdocs to a remote server within this directory
=>/var/www/html/
=>Am I correct with this command, or far away offff
=>
=>tar zcvf -  /usr/local/apache/htdocs | ssh root at 1.2.3.4 "cat >
=>/var/www/html/htdocs.tar.gz"

That won't work because all you'd end up with is a transfer of the tar.gz
file. It will not have been unpacked. You probably intend something like


cd /usr/local/apache
tar -zcvf htdocs | ssh root at 1.2.3.4 "cd /var/www/html; tar -zxf -"

Of course, scp -r will probably also work too. ;-)

And for the people who do it right in the first place...

find htdocs -print | cpio -o | \
ssh root at 1.2.3.4 'cd /var/www/html; cpio -idvum'


-- 
Time flies like the wind. Fruit flies like a banana. Stranger things have  .0.
happened but none stranger than this. Does your driver's license say Organ ..0
Donor?Black holes are where God divided by zero. Listen to me! We are all- 000
individuals! What if this weren't a hypothetical question?
steveo at syslang.net




More information about the redhat-list mailing list