Simpler Navigation for Servers and Operating Systems - Please Update Your Bookmarks
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
If you have bookmarked forums or discussion boards in Servers and Operating Systems, we suggest you check and update them as needed.
cancel
Showing results for 
Search instead for 
Did you mean: 

TAR - Backup with Absolute Path

SOLVED
Go to solution
DK Raviraja
Occasional Advisor

TAR - Backup with Absolute Path

We got a MEDIA with files backed up using ABsolute Path. How to restore the files to our own directory.

If I give tar -xvf it replaces existing files. How to avoid this ?. Is there any switch so that the files can restored in any other location ?
Mera Bharath Mahan
8 REPLIES
Andreas Voss
Honored Contributor
Solution

Re: TAR - Backup with Absolute Path

Hi,

you can use pax:

change to directory where you want to restore:
cd
Then do:
pax -rv -s'/^\///'
This will restore the archive into the current directory.

Regards

Ken Scharpell
Valued Contributor

Re: TAR - Backup with Absolute Path


or download and install gnu tar, by default it restores to the current directory (for absolute paths you need an option).
The whole world is a simple perl script
DK Raviraja
Occasional Advisor

Re: TAR - Backup with Absolute Path

Hello

What is this GNu tar. Can you please give me site address.

Thanks & Regds
DKR Bhat
Mera Bharath Mahan
Andreas Voss
Honored Contributor

Re: TAR - Backup with Absolute Path

Hi,

here the URL for gnuTar:
http://hpux.cs.utah.edu/hppd/hpux/Gnome/guiTAR-0.1.4/

Regards
Andreas Voss
Honored Contributor

Re: TAR - Backup with Absolute Path

Hi,

sorry that was the wrong link.
Here the correct link:
http://hpux.cs.utah.edu/hppd/hpux/Gnu/tar-1.13.16/

Regards
Santosh Nair_1
Honored Contributor

Re: TAR - Backup with Absolute Path

Hi,

You could also try the '-C ' (thats a capital C) option to HP's tar which is supposed to chdir to before it starts extracting from the archive. Hope this help.

Life is what's happening while you're busy making other plans
DK Raviraja
Occasional Advisor

Re: TAR - Backup with Absolute Path

Dear Nair,

My default dir is /home/dkrbhat
My TAR File name is dkr.TAR
Created a dir test

tar -xvf dkr.TAR -C test does not restore files

Can you give me a example.

Of course I completed the job using PAX command !!
Mera Bharath Mahan
Santosh Nair_1
Honored Contributor

Re: TAR - Backup with Absolute Path

My apologizes. Stupid of me to post without testing it out first. In any case, the -C option only works for creating the archive, i.e. you can specify multipile -C and it will add the file to the archive with a relative path to . But apparently this doesn't work when extracting from the archive (a fact NOT mentioned in the man page). Again apologies.

-Santosh
Life is what's happening while you're busy making other plans