开发者

Destination directory while compressing using tar

开发者 https://www.devze.com 2023-01-27 13:34 出处:网络
I have a directory say \"DIR\" which contains so many directories say \"A\", \"B\" and \"C\" I want to tar DIR without including \"C\" in it so that DIR.tar开发者_如何学C.gz does not contain the dire

I have a directory say "DIR" which contains so many directories say "A", "B" and "C"

I want to tar DIR without including "C" in it so that DIR.tar开发者_如何学C.gz does not contain the directory "C".

What is the shell command for this?

Thanks, LinuxPenseur


Depending on your command line, something like this:

tar -cf archive.tar --exclude C DIR

Also, to nitpick your question, tar does not perform compression.


Try this

tar --exclude="C" -czvf D.tar.gz DIR
0

精彩评论

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

关注公众号