You are looking for an argument --exclude.
--exclude=PATTERN
Some users find the excludeoptions confusing. Here are some common mistakes:
The main mode of operation tardoes not work by the path name is explicitly indicated on the command line if one of its components file name is excluded. In the above example, if you create an archive and exclude files ending in *.o, but explicitly called a file dir.o/fooafter all parameters have been specified, it
dir.o/foowill be excluded from the archive.
--exclude=PATTERN
--exclude-from=FILE-OF-PATTERNS (-X FILE-OF-PATTERNS).
: --exclude=PATTERN, , ,
.
--exclude-from=FILE-OF-PATTERNS
, ;
, .
--exclude=PATTERN, PATTERN
, GNU tar , *.
, *,
, tar
, .
, .
, :
$ tar -c -f ARCHIVE.TAR --exclude '*.o' DIRECTORY
:
$ tar -c -f ARCHIVE.TAR --exclude *.o DIRECTORY
- globbing,
regexp
tar.
regexp ,
.