Operating System - HP-UX
1753492 Members
5253 Online
108794 Solutions
New Discussion юеВ

Re: tar extract to other dir

 
Gordon_3
Regular Advisor

tar extract to other dir

Hi all,

Suppose I have a tar archieve ( relative path tar ) , is there any way that I can untar the file to other dir? Thx.

Gordon
Gordon
5 REPLIES 5
Stefan Farrelly
Honored Contributor

Re: tar extract to other dir

With HP's tar you can do it, but you can try gnu tar, it has an option to extract to a different dir. You can download it from;

http://hpux.cs.utah.edu/hppd/hpux/Gnu/tar-1.13.25/
Im from Palmerston North, New Zealand, but somehow ended up in London...
melvyn burnard
Honored Contributor

Re: tar extract to other dir

Well if the tar archive was created with relative path, then simply go into the directory you wish to be in, and extract.
Otherwise, take a look at hte pax command, as this can read both tar and cpio commands, and can extract to a different path from a tar archive that has been created with absolute path names.
man pax
My house is the bank's, my money the wife's, But my opinions belong to me, not HP!
Gordon_3
Regular Advisor

Re: tar extract to other dir

Hi 2,

Thx for yr advise, but u know say the tar file is 10G, actually u need 20GB to untar the file ( double size ) which I don't wanna to happen....any idea?

Gordon
Gordon
T G Manikandan
Honored Contributor

Re: tar extract to other dir

relative path is always easier.

Just do into another dir
Then do
#tar xvf /dev/rmt/?m

that should do it .

If you want absolute path files to be restored from tar then

check this doc

http://www1.itrc.hp.com/service/cki/docDisplay.do?docLocale=en_US&docId=200000062909266
Stefan Farrelly
Honored Contributor

Re: tar extract to other dir

Well yes, if you have a 10G tar file and want to extract it you need an additional 10G to untar it, then you can remove the 10G tar file.

If you dont have space for this then all I can think of is gzip the tar file (which will still need a few more Gb to write the tar.gz file in the first place - but < 10G) then you can gunzip and untar at the same time - so youre using less space than 20G.
Im from Palmerston North, New Zealand, but somehow ended up in London...