How can I untar a sub directory?
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
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
tar xf mytar.tar
mv /level1/* .
精彩评论