The traditional approach...viva unix...

No tarball other than in the streams...

$ (cd src_dir; tar cvf - .) | (cd target_dir; tar xvf -)

or never change your current directory, but wish to redirect from an existing tarball:

$ (cd tarfile_dir; tar xvf - tarball.tar) | (cd tgt_dir; tar xvf -)
Update:As mem points out below, the second example above is sort of meaningless -- no need for the pipe...this is what I meant:

$ (cd tgt_dir; tar xvf - src_dir/tarball.tar)

In the cases where the tarball already exists, this presumes that the directory paths are relative vs. absolute. (as is pointed out below, you can use -C to redirect absolute paths to relative)

Matt

update: removed redundant first example, functionally nothing more than:

$ cd tgt_dir; tar xvf src_dir/tarball.tar

Because I was thinking of:

$ gunzip -c tarball.tar.gz | (cd tgtdir; tar xvf -)

In reply to Re: tar_mv: move tar data as it's being extracted by mojotoad
in thread tar_mv: move tar data as it's being extracted by belden

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.