-X 参数:将排除的文件(夹)写到文件里。
-X ExcludeList
Excludes the file names or directories given in the ExcludeList from the tar archive being created, extracted or
listed. The ExcludeList shall contain only one filename or directory per line which are to be excluded from the tar
archive being created, extracted from or listed. The -X option can be specified multiple times and it takes precedence over all other options.
命令:tar zcvf tomcat.tar.gz -X exclude.list tomcat
exclude.list:
tomcat/apps/*
tomcat/backup/*
tomcat/blive
tomcat/cloudhis
tomcat/cloudorder
tomcat/consultation
tomcat/datacenter
…
博客介绍了tar命令的 -X 参数,可将需排除的文件或文件夹写在文件里。该参数能在创建、提取或列出tar存档时排除指定内容,可多次指定且优先级高于其他选项,还给出了具体命令及排除文件列表示例。
1万+

被折叠的 条评论
为什么被折叠?



