Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Something along the lines of tar --blacklist='foo.bar foo.baz' -czvf foo.tar.gz ./*

such that any files named foo.bar or foo.baz in the current directory or subdirectories would be ignored?

share|improve this question

2 Answers 2

up vote 1 down vote accepted

--exclude:

--exclude=PATTERN

exclude files, given as a PATTERN

Also relevant:

--no-anchored

patterns match after any `/' (default for exclusion)

(taken from tar(1) man page)

share|improve this answer

Next time, please try doing some research before asking here.

$ 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
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.