Operating System - HP-UX
1830676 Members
2690 Online
110015 Solutions
New Discussion

Re: tar extracting specific directories

 
Joel R. Ong
New Member

tar extracting specific directories

Hi, I'm having problems extracting a tar archive from a multi-volume tape.

There are several directories on the tar file and I only want to extract a few subdirectories recursively.

I have tried:

tar -xvf /dev/rmt/0m /data1 /data2

but it doesn't extract the directories. It just reads until it prompts for the next device. This is a multi-volume tar tape consisting of seven 4gb tapes, and I *know* that /data1 would be on the first tape.

I've also tried

tar -xvf /dev/rmt/0m /data1/ /data2/

with just the same luck. And yes, if you ask, the /data1 and /data2 directories were backed-up with absolute directory paths.

Can anyone point out what I am doing wrong?
Thanks :)
2 REPLIES 2
Rajeev  Shukla
Honored Contributor

Re: tar extracting specific directories

Extracting specific directories from a tar files only needs that way they were backed up or tar'd
if you did a tar -cvf /dev/rmt/0m *
then to untar you need to do tar -xvf /dev/rmt/0m data1 data2
and if you tared using
tar -cvf /dev/rmt/0m .
then you need to do tar -xvf /dev/rmt/0m /data1

do a tar tvf to list how they are backed up, if you dont see "/" in front then just follow

tar -xvf /dev/rmt/0m data1 data2
That should restore the directories,

Cheers
Rajeev
Sanjay Kumar Suri
Honored Contributor

Re: tar extracting specific directories

I don't think anything wrong is being done. It seems tar will scan all the tapes to extract the required data.

sks
A rigid mind is very sure, but often wrong. A flexible mind is generally unsure, but often right.