1847249 Members
2865 Online
110263 Solutions
New Discussion

Re: tar

 
angelo_11
Occasional Contributor

tar

Hi,

i have a tar file xx.file it contains files with absolute path.

/Arr/AA/BB/file1
/Arr/AA/BB/file2
/Arr/AA/BB/file3
.
.
..

I need to untar the in a different path
/XX/YY/TT

how can I have all the files into /XX/YY/TT ?

thanks



5 REPLIES 5
Peter Godron
Honored Contributor

Re: tar

Angelo,
you can't with standard tar. However you can use gnu tar (gtar) or pax with -s option.

http://hpux.cs.utah.edu/hppd/hpux/Gnu/tar-1.15.1/
Peter Nikitka
Honored Contributor

Re: tar

Hi,

use 'pax' to read back the tarfile content under a different path.
BTW., it is not a good idea anyway, to store absolute pathnames in a tarfile.

cd resultdir
pax -r -s:/Arr/AA/BB:XX/YY/TT: /pathname/xx.tar


mfG Peter
The Universe is a pretty big place, it's bigger than anything anyone has ever dreamed of before. So if it's just us, seems like an awful waste of space, right? Jodie Foster in "Contact"
Jeroen Peereboom
Honored Contributor

Re: tar

On Linux, GNU tar will remove leading '/'.

#tar xf mw.tar
tar: Removing leading `/' from member names

Don't be root.
There is a special option for not removing leading '.' (-P, check manpage).

JP

P.S. Don't ask the same question twice please...
Peter Godron
Honored Contributor

Re: tar

Victor BERRIDGE
Honored Contributor

Re: tar

Hi,
Peter Nikita gave you the solution...
I do the same:
Copy the archive to
the relative location in
which you wish to untar it.

Then, execute the following
command:

pax -r -s ',^/,,' -f file.tar


All the best
Victor