Syntax
X/Open Standards:
tar {-c|-r|-t|-u|-x} [-B] [ -d ] [ -E ] [ -F ] [-h ] [ -i ] [ -l ] [ -m ] [ -o ] [ -p ] [ -s ] [ -U ] [ -v ] [ -w]
* [-Number] [-f Archive] [-b Blocks]
* [-S [Feet] [Feet @Density] [Blocksb]] [-L InputList] [-X ExcludeList]
* [-N Blocks] [-R] [-D] [-C Directory] [ -Z ] File | Directory ...
Berkeley Standards:
tar { c | r | t | u | x } [ b B d D E f F h i l L X m N o p R s S U v w Z [ 0-9 ] ]
* [ Blocks ] [ Archive ] [ InputList ] [ ExcludeFile ]
* [ [ Feet ] | [ Feet@Density ] | [ Blocksb ] ] Directory | File ...
man文件可知,有兩種寫法:
1、tar -cvpf 2.tar -X exclude *
$ cat exclude 1.txt mk1
$ tar -cvpf 2.tar -X exclude * a 1.tar 20 塊。 a 1.txt(已排除) a 2.txt 0 塊。 a 3.txt 0 塊。 a 4.txt 0 塊。 a exclude 1 塊。 a mk1(已排除) a mk2 a mk3
2、tar cvpfX 3.tar exclude ./*
$ tar cvpfX 3.tar exclude ./* a ./1.tar(已排除) a ./1.txt(已排除) a ./2.tar(已排除) a ./2.txt 0 塊。 a ./3.txt 0 塊。 a ./4.txt 0 塊。 a ./exclude 1 塊。 a ./mk1(已排除) a ./mk2 a ./mk3