Lazy Diary @ Hatena Blog

PowerShell / Java / miscellaneous things about software development, Tips & Gochas. CC BY-SA 4.0/Apache License 2.0

指定のファイル名を除外する (2)

http://d.hatena.ne.jp/satob/20040922#p2
tar に --exclude pattern というオプションがあるようなので使ってみる。

$ ls
inn.conf        inn.conf.bak    inn.conf.dist   inn.conf.org
$ tar -cz --exclude *.org --exclude *.bak --exclude *.dist -f a.tar.gz *
$ tar tzf a.tar.gz | cat
inn.conf
$ 

いい感じで除外できている。*1

*1:最後の出力に cat をかましてるのは、こうしないと kterm からのコピーのときになぜか改行がされないので。何でだろう?