動作環境
CentOS 6.8 (64bit)
Python 2.6.6 (r266:84292, Aug 18 2016, 15:13:37)
Python 3.6.0 on virtualenv
GNU bash, version 4.1.2(1)-release (x86_64-redhat-linux-gnu)
date (GNU coreutils) 8.4
tmux 1.6-3.el6
tar (GNU tar) 1.23
--exclude-tag
man @ explainshell.com
--exclude-tag=FILE
exclude contents of directories containing FILE, except
explainshell.comのバグのためか、説明が途中で切れている。
「exclude contents of directories containing FILE, except for FILE itself」
使用例
以下のファイルがあるとする。
$ ls DIR01/
doko01.txt zun01.txt
exclude-tag用のファイルを作成する。
$ touch DIR01/exclude_tag
タグを元にtarしてみる。
$ tar cvzf assortment.tgz DIR01/ --exclude-tag=exclude_tag
DIR01/
tar: DIR01/: contains a cache directory tag exclude_tag; contents not dumped
DIR01/exclude_tag
tarファイルを確認すると以下となる。
$ tar tvzf assortment.tgz
drwxrwxr-x xxx/xxx 0 2018-03-05 17:55 DIR01/
-rw-rw-r-- xxx/xxx 0 2018-03-05 17:55 DIR01/exclude_tag
用途 (推測)
- 特定のディレクトリは圧縮対象外にしたい
- 一方で、圧縮対象外にした情報はtar.gzの中に残しておきたい
- tagファイルは圧縮する
オプション
以下はman tarの情報。
--exclude-tag=FILE
exclude contents of directories containing FILE, except for FILE
itself
--exclude-tag-all=FILE exclude directories containing FILE
--exclude-tag-under=FILE
exclude everything under directories containing FILE
--exclude-tag-all
と--exclude-tag-under
の違いは未消化。