tar压缩时排除指定目录的方法
时间:2015-05-02 00:02 来源:www.it.net.cn 作者:IT
tar压缩文件时排除指定目录的方法。
假设 test目录下有 1 2 3 4 5 这5个目录,现在要将 3 4 5目录tar打包,1和2目录不要。
命令:
tar -zcvf test.tar.gz --exclude=1 --exclude=2 test
或
tar -zcvf test.tar.gz --exclude=test/1 --exclude=test/2 test
看man tar帮助,--exclude后面跟的好像是正则。
注意: 要打包的test必须在命令最后。
(责任编辑:IT)
tar压缩文件时排除指定目录的方法。 假设 test目录下有 1 2 3 4 5 这5个目录,现在要将 3 4 5目录tar打包,1和2目录不要。
命令:
tar -zcvf test.tar.gz --exclude=1 --exclude=2 test
或 tar -zcvf test.tar.gz --exclude=test/1 --exclude=test/2 test 看man tar帮助,--exclude后面跟的好像是正则。 注意: 要打包的test必须在命令最后。 (责任编辑:IT) |