Get specific file from tar
Hello ALl,
I am doing TAR backup for our Portal Application. I used following command to do TAR backup. tar -cvf tstname.tar /home/portal/you Now I need to recover only one specific file from the TAR. for instead I have file called tset3 under home/portal/you. I wanted to untar or recover only test3. Please advice. thanks |
Hi
I believe dar is the application that you are looking for. I have not used it before so I cannot tell you for sure. Go here and look at the section "direct access" http://dar.linux.free.fr/doc/Features.html I hope this helps. Cheerz |
Quote:
Code:
$ tar -xf tstname.tar (desired file path and name) |
Not found in archive
tar xf testbk.tar /opt/IBM/test
tar: /opt/IBM/test: Not found in archive tar: Error exit delayed from previous errors |
try this
Code:
tar xf testbk.tar -C /opt/IBM/test unless /opt/IBM/test is the filename in that case it must not be in the archive |
tar: Error is not recoverable: exiting now
tar xf testbk.tar -C /opt/IBM/test
tar: /opt/IBM/test: Cannot chdir: Not a directory tar: Error is not recoverable: exiting now |
Hi
If: If you find tar to be fast enough for you, then ignore me. Else: make a dar archive Code:
dar -c <archive_name> -y -s <size> -R <path> -y enable bz2 compression Extract single file: Code:
dar -x <archive_name> --go-into <path> PS. If you made your archive with archive name "backup" use "backup" also as archive name in extraction and not not the spesific slices that dar has made. Here is a link if you want more help http://dar.linux.free.fr/doc/mini-ho...-howto.en.html Greetings |
Quote:
If you didn't use this option during tar create, it will have stripped 1st/leading '/' from each filepath, so that you can re-locate the files during extracts. To see what you've actually got, try tar -tvf blah.tar and go from there. |
Quote:
|
Quote:
I did the tar as below tar -cvf testbk.tar /opt I have a file called "test" exist under /opt/IBM I need to retrieve only test file How do you retrieve? |
See my post #8; default for tar is to strip leading '/'.
|
If I do tar -tvf testbk.tar this it will untar all files.
We have 20GB TAR backup. We do not want top open every single directory or file. We want to run the script to open only one file from the TAR backup. |
No it doesn't; read the link I gave you. -t lists the table of contents.
|
All times are GMT -5. The time now is 06:43 AM. |