cancel
Showing results for 
Search instead for 
Did you mean: 

tar with absolute patch

angelo_11
Occasional Contributor

tar with absolute patch

Hi,

I have a tar file
xx.tar
It contains files with absolute path such as
/Arr/bla/tra/myfile.txt
/Arr/bla/tra/myfile1.txt
/Arr/bla/tra/myfile2.txt
.
.
.



I need to extract files from tar and put them in another directory such as :
/XX/YY/TT
how can I do so ?

many thanks
Angelo

3 REPLIES
Ian Vaughan
Honored Contributor

Re: tar with absolute patch

Howdy,
If you can't dereference the absolute pathname how about creating a symbolic link with the path that the tar file is expecting? Make the symlink point to where you actually want the files to appear then delete the link after wards.

HTH
Ian
Hope that helps - please click "Thumbs up" for Kudos if it does
## ---------------------------------------------------------------------------##
Which is the only cheese that is made backwards?
Edam!
Tweets: @2techie4me
Jeroen Peereboom
Honored Contributor

Re: tar with absolute patch

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
Steven E. Protter
Exalted Contributor

Re: tar with absolute patch

Shalom Angelo,

Yes.

options:
mv the tar file to the top of the absolute path and tar xvf it there.

-C directory option at unzip time.

Example:
tar -xvf foo.tar -C bar/

Its all from the man page because I don't trust my memory.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com