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必须在命令最后,不然没有效果.

国内免备案VPS301跳转服务器国内免备案服务器域名被墙跳转301,绕过信息安全中心不放违反法律法规内容!(北京免备案 镇江免备案 江苏免备案 辽宁免备案vps 山东联通免备案
 
在线咨询