tar打包不包含logs目录

2019-06-25

tar zcf a.gz a -X exclude.list.txt

1、-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.

exclude.list里面的内容

tomcat-web/logs
2、find . -type d |grep \/logs|grep -v backup >> exlude.list
3、tar zcvf a.gz a/ -X exlude.list

分类:Linux | 标签: |

相关日志

评论被关闭!