in reply to tar_mv: move tar data as it's being extracted
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:
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 tarfile_dir; tar xvf - tarball.tar) | (cd tgt_dir; tar xvf -)
$ (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 -)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: tar_mv: move tar data as it's being extracted
by mem (Acolyte) on Jul 30, 2002 at 07:11 UTC | |
by belden (Friar) on Jul 31, 2002 at 20:52 UTC |