开发者

How can I untar a sub directory?

开发者 https://www.devze.com 2022-12-27 15:50 出处:网络
Suppose I have a tar that contains: 开发者_开发技巧 /# Root directory /level1/# A sub directory /level1/a.file

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

精彩评论

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

关注公众号