Operating System - HP-UX
1831029 Members
2609 Online
110018 Solutions
New Discussion

Re: extracting absolute path archive

 
SOLVED
Go to solution
Allan Pincus
Frequent Advisor

extracting absolute path archive

Hi,

I have a tar archive that I need to extract that uses an absolute path that conflicts with an absolute path I already have on my system and don't want to disrupt.

Does anyone know how to extract a tar archive so that the absolute path can be placed relative to some other higher level path, or am I hosed?

- allan
2 REPLIES 2
Patrick Wallek
Honored Contributor
Solution

Re: extracting absolute path archive

Yet another reason never to use absolute paths.

I believe that 'pax' can deal with this. pax is a utility that can read or write tar and cpio archives. There is some built in functionality that will allow you to do things with the path of the files as your restore.

Do a 'man pax' for more information and examples.
Cheryl Griffin
Honored Contributor

Re: extracting absolute path archive

http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x589bd5fab40ed6118ff40090279cd0f9,00.html

says to try using pax:
"If you created the tar file using relative pathnames for the input files, tar will extract the files to locations relative to your current directory.

If you created the tar file using absolute pathnames for the input files, tar will extract the files to that absolute path.

An alternative for changing the extract destination for a tar file created with absolute pathnames is to use pax. An example is:

tar cvf /tmp/users.tar /home/users

tar xvf /tmp/users.tar
will extract files back to their original locations because the input file/dir was specified with an absolute pathname (/home/users)

pax -r -s,/home/users,/home/users2, -f /tmp/users.tar
will extract files changing /home/users to /home/users2

See the man page for more info. "

Cheryl
"Downtime is a Crime."