scp / zip command - Unix

This is a discussion on scp / zip command - Unix ; I am trying to write this command to tar/gz and then transfer a the file accross to another server I also wanted to untar/unzip the file. can this be done? tar -cf - osf | gzip > osfx.tar.gz | scp ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: scp / zip command

  1. scp / zip command


    I am trying to write this command to tar/gz and then transfer a the
    file accross to another server
    I also wanted to untar/unzip the file. can this be done?

    tar -cf - osf | gzip > osfx.tar.gz | scp osfx.tar.gz
    1.99.999.135:/tmp

  2. Re: scp / zip command

    rva...@gmail.com wrote:
    >
    > * I am trying to write this command to tar/gz and then transfer a the
    > file accross to another server
    > * I also wanted to untar/unzip the file. *can this be done?
    >
    > * * tar -cf - osf | gzip *> osfx.tar.gz | scp osfx.tar.gz


    you need to learn more carefully what each tool does with its
    command line, its standard input and its standard output.

    Consider that you tell the gzip to send its output to a file but
    you also tell it to send its output to a pipe. That's not how
    IO works. Each redirection gets a command not a file. And
    the ones to files end a sequence so no more pipes after that.

    What you describe in your words is a sequence that does not
    even include a file:

    tar -cf - osf | gzip | ssh some_unspecified_host "cd someplace ;
    gunzip | tar -xf -"

    Doing the pipe like that compression adds an unnecessary
    complexity. The use of tar across a pipe is simple and appears
    in the tar man page in the examples.

  3. Re: scp / zip command

    On Fri, 22 Feb 2008 14:40:45 -0800, Doug Freyburger wrote:

    > rva...@gmail.com wrote:
    >>
    >> * I am trying to write this command to tar/gz and then transfer a the
    >> file accross to another server
    >> * I also wanted to untar/unzip the file. *can this be done?
    >>
    >> * * tar -cf - osf | gzip *> osfx.tar.gz | scp osfx.tar.gz

    >



    You may be over-complicating matters...

    Firstly, you could use tar as described in the man page (as Doug
    suggested), but add the -C flag to scp - which would enable compression/
    uncompression of the transferred data automatically - removing the need
    for gzip/gunzip.

    Secondly, if what you are trying to achieve is to recreate a directory
    structure on another host with compression during the transfer, you could
    simply use: scp -r -C osf remotehost:/tmp

    HTH,
    Ade.

    --
    Adrian Ball
    http://www.majords.co.uk/
    Do not use spam-trap ab.usenet address - please use:-
    ade at majords . co . uk

  4. Re: scp / zip command

    Adrian Ball wrote:
    > Secondly, if what you are trying to achieve is to recreate a directory
    > structure on another host with compression during the transfer, you could
    > simply use: scp -r -C osf remotehost:/tmp


    But scp won't deal well with permissions and special files...

    tar cfpsP - /orig | ssh dest -C tar xf -

    would do that.

    cheers,
    --renato

+ Reply to Thread