开发者

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/* .
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜