Extracting file from tar at relative location!!


 
Thread Tools Search this Thread
Operating Systems Solaris Extracting file from tar at relative location!!
# 8  
Old 06-01-2009
tirupathi: that isn't going to work with absolute pathnames.

kumarmani: you need to tell what the tar file contains as path to rewrite for me to provide a full command line.
# 9  
Old 06-01-2009
Quote:
Originally Posted by jlliagre
You can use pax "-s" option which allows substituting path components on the fly. Gnu tar (gtar) might have a similar feature but is lacking a decent manual page for me to check.
Gnu tar does not use absolute paths by default (-P would be required) . Using gtar to uncompress will strip the leading / on the pathnames, giving a relative restore of archives created using traditional tar.
# 10  
Old 06-01-2009
Try this:

Code:
tar -xobf  cron.tar 15

# 11  
Old 06-01-2009
fist u tell u want relative or absolute thru tar command
absolute backup
tar -cvf /dev/rmt/0 /usr
now iam in /etc direcitory
cd /etc
tar -xvf /dev/rmt/0
it store the files in usr directory

realative backup

iam taking the backup
now iam in cd /usr
tar -cvf /dev/rmt/0 .
iam restoring the new directory
mkdir /sol
cd /sol
tar -xvf /dev/rmt/0

absolute backup means where ever u take the backup restore in same diraectory it's mainly used an systemfiles
relative backup used an user files
# 12  
Old 06-01-2009
Quote:
Originally Posted by reborg
Gnu tar does not use absolute paths by default (-P would be required) . Using gtar to uncompress will strip the leading / on the pathnames, giving a relative restore of archives created using traditional tar.
Thanks for the tip. Then pax can be replaced by a combination of gtar and mv. If the Solaris release is lacking gtar, pax might still be helpful.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Convert Relative path to Absolute path, without changing directory to the file location.

Hello, I am creating a file with all the source folders included in my git branch, when i grep for the used source, i found source included as relative path instead of absolute path, how can convert relative path to absolute path without changing directory to that folder and using readlink -f ? ... (4 Replies)
Discussion started by: Sekhar419
4 Replies

2. OS X (Apple)

Uncompressing but not extracting tar.Z file

Hi I have a few hundred files with extension .tar.Z. These files were archived (tar) and compressed (Z) on a UNIX system. I need to unzip them but not extract them. In other words they need to go to .tar extension. I would like to do this on my MAC or on a windows pc. I do not have a UNIX... (3 Replies)
Discussion started by: kalbano
3 Replies

3. Shell Programming and Scripting

tar and relative paths

HOw can I create a tar file with relative paths find . -depth -print | xargs tar -cvf /tmp/file.tar ? Thanks to all who answer (1 Reply)
Discussion started by: BeefStu
1 Replies

4. UNIX for Dummies Questions & Answers

tar symlinks: relative vs absolute

I create the tar file from / like so: tar cEhf name.tar usr/us And this creates the tar with the links intact. The problem is that this tar is going to be used for testing, so we want the links to point to the files in the tar. But when I extract the tar into /tmp, I get /tmp/usr/us/... as I... (2 Replies)
Discussion started by: TreeMan
2 Replies

5. Shell Programming and Scripting

How to read the content of the particular file from tar.Z without extracting?

Hi All, I want to read the content of the particular file from tar.Z without extracting. aaa.tar.Z contains a file called one.txt, I want to read the content of the one.txt without extracting. Please help me to read the content of it. Regards, Kalai. (12 Replies)
Discussion started by: kalpeer
12 Replies

6. UNIX for Dummies Questions & Answers

Extracting from a tar archive file

Can I extract files from an archive file (tar), where the filename includes the full directory path, to a different directory? For example the archive files may have a filename of /SrcFiles/XXX/filename.dat and I want to extract it to /SrcFiles/YYY/filename.dat. Since the archive file was... (1 Reply)
Discussion started by: nmalencia
1 Replies

7. UNIX Desktop Questions & Answers

Extracting from a tar file

Can I extract files from an archive file (tar), where the filename includes the full directory path, to a different directory? For example the archive files may have a filename of /SrcFiles/XXX/filename.dat and I want to extract it to /SrcFiles/YYY/filename.dat. Since the archive file... (1 Reply)
Discussion started by: nmalencia
1 Replies

8. UNIX for Dummies Questions & Answers

Untar a TAR file at different location

Hi, I want to UNTAR a TAR file at different location. Is it possible? My TAR file contains the files with absolute path. Malay (5 Replies)
Discussion started by: malaymaru
5 Replies

9. UNIX for Dummies Questions & Answers

extracting from a tar file

Dear experts I have received a tar file containing several files with full path. Now I need to restore it in another system but when I want to extract files by using tar -xvf tarfile it wants to create all files with full paths again in new system in which I don't have enough previleges. How... (4 Replies)
Discussion started by: Reza Nazarian
4 Replies

10. Solaris

Restoring TAR'd file to different location

Is it possible to restore a TAR'ed file off of a tape to a location other than the original location? If so, how? (The MAN pages give examples of how to restore only to the originating location.) Thanks!! (1 Reply)
Discussion started by: FredSmith
1 Replies
Login or Register to Ask a Question