命令:

tar -czvf xx.tar.gz --exclude-from=./exclude.lst xx

注:xx是要打包的目录,xx.tar.gz是压缩包名,./exclude.lst中记录了要排除的文件

exclude.lst文件样例:

dir1

dir2/*.txt