Re: The tar trick !!!



On Sun, 07 Jun 2009 22:38:25 +0100, Chris Davies wrote:

Robert Heller <heller@xxxxxxxxxxxx> wrote:
tar cf - myfile . | ssh anna@server1 'cd /home/anna/server1; tar xvf -
' Although this is also wrong ('myfile' will get copied twice).

If the cd on the remote end fails, the tar will extract to the user's
home directory - not necessarily what you want. You can handle this by
using the && construct. As a further potential optimisation, given the
assumption that anna@server1 has a home directory of /home/anna, you can
combine the two and use this:

tar cf - . | ssh anna@server1 'cd server1 && tar xvf -'

Is the "cd server1" needed?

tar -cf - . | ssh anna@server1 'tar -xv -C server1 -f -'

.



Relevant Pages

  • Re: use of the date command in tar
    ... tar: Error is not recoverable: exiting now ... when the file is extracted it creates a folder named home which the ... Could that overwrite the home directory if a user opened it ... you extract it, it creates no directory at all it simply places the ...
    (comp.unix.shell)
  • Re: use of the date command in tar
    ... tar: Error is not recoverable: exiting now ... when the file is extracted it creates a folder named home which the ... Could that overwrite the home directory if a user opened it ... you extract it, it creates no directory at all it simply places the ...
    (comp.unix.shell)
  • Re: The tar trick !!!
    ... If the cd on the remote end fails, the tar will extract to the user's ... home directory - not necessarily what you want. ...
    (comp.os.linux.misc)
  • Re: The tar trick !!!
    ... If the cd on the remote end fails, the tar will extract to the user's ... home directory - not necessarily what you want. ... AFAIK server1 is a FQDN ...
    (comp.os.linux.misc)
  • Re: CGI newb... redirect page
    ... > home directory, so I was going to have a .py file in cgi-bin forward the ... > correct error page. ... when I do extract this info... ... But, I still don't know how to forward, or redirect a page. ...
    (comp.lang.python)