Operating System - HP-UX
1832645 Members
2596 Online
110043 Solutions
New Discussion

Re: Tar archive, extracting all but one directory

 
SOLVED
Go to solution
Pedro Cirne
Esteemed Contributor

Tar archive, extracting all but one directory

Hi,

I've a huge tar archive and I want to extract all files except a directory called ebx_ex/xe_test, how can I do this?

Thks,

Pedro
3 REPLIES 3
James R. Ferguson
Acclaimed Contributor

Re: Tar archive, extracting all but one directory

Hi Pedro:

You can use 'pax' to extract a 'tar' archive' and select files based on a pattern match. For instance:

# tar -cvf /tmp/archive /tmp/f1 /tmp/f2 /tmp/f3

...archive three files...

# pax -r -f /tmp/archive /tmp/f[13]

...recover file 'f1' and 'f2' only.

Regards!

...JRF...
Patrick Wallek
Honored Contributor
Solution

Re: Tar archive, extracting all but one directory

You can use pax to do this.

# pax -rvf tar_archive_name.tar -c ebx_ex/xe_test

Have a look at the pax man page for more information.
Pedro Cirne
Esteemed Contributor

Re: Tar archive, extracting all but one directory

It works! Thks!