tags:

views:

77

answers:

2

Suppose I have a tar that contains:

/                # Root directory
/level1/         # A sub directory
/level1/a.file
/level1/b.file
/level1/...      # The rest

How can I do something like tar -xf that would untar the contents level1/ like this:

/a.file
/b.file
/...       # The rest 
A: 
tar xf mytar.tar
mv /level1/* .
ghostdog74
That'll leave all the other contents of the tar all over the current directory. At least use `tar xf mytar.tar level1`.
Ben Voigt
+2  A: 

As long as it involves a simple sub-directory like my original question, I found I can do this:

tar -xzf mytar.tgz --strip-components 1
Kristopher Ives