0

According to the GNU tar manual page, directories containing a CACHEDIR.TAG file can be excluded by specifying a command-line option, such as --exclude-cache .

This doesn't seem to happen.

$ mkdir -p t/a/b/c
$ touch t/a/b/foo t/a/b/CACHEDIR.TAG
$ tar --exclude-caches-all -cvf /dev/null t
t/
t/a/
t/a/b/
t/a/b/c/
t/a/b/CACHEDIR.TAG
t/a/b/foo
5

A look at the GNU tar source code (and then at the Texinfo documentation) reveals that the file needs to contain a special signature. Adding this signature to the file fixes the problem.

$ mkdir -p t/a/b/c
$ touch t/a/b/foo
$ echo Signature: 8a477f597d28d172789f06886806bc55 >t/a/b/CACHEDIR.TAG
$ tar --exclude-caches-all -cvf /dev/null t
t/
t/a/
tar: t/a/b/: contains a cache directory tag CACHEDIR.TAG; directory not dumped

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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