类似于 tar --blacklist='foo.bar foo.baz' -czvf foo.tar.gz ./*
这样当前目录或子目录中任何名为 foo.bar 或 foo.baz 的文件都会被忽略?
答案1
答案2
下次,请在在这里提问之前尝试做一些研究。
$ man tar | grep -A 2 exclude
--exclude=PATTERN
exclude files, given as a PATTERN
--exclude-backups
exclude backup and lock files
--exclude-caches
exclude contents of directories containing CACHEDIR.TAG,
--exclude-caches-all
exclude directories containing CACHEDIR.TAG
--exclude-caches-under
exclude everything under directories containing
CACHEDIR.TAG
--exclude-tag=FILE
exclude contents of directories containing FILE, except
--exclude-tag-all=FILE
exclude directories containing FILE
--exclude-tag-under=FILE
exclude everything under directories containing FILE
--exclude-vcs
exclude version control system directories
-X, --exclude-from FILE
exclude patterns listed in FILE