tar with --include Gets Much More.
Martin McCormick
martin at dc.cis.okstate.edu
Tue May 18 13:52:59 UTC 2010
The FreeBSD man page for tar shows
--include pattern (-W include=pattern)
Process only files or directories that match the specified pat-
tern. Note that exclusions specified with --exclude take prece-
dence over inclusions. If no inclusions are explicitly speci-
fied, all entries are processed by default.
This sounded useful in what one might do when rebuilding
a name server, for example. One could tar only that part of /var
containing the /var/named directory so I tried:
tar cvf tst.tar /var --include named
and
tar cvf tst.tar /var --include='* named*'
tar: Removing leading '/' from member names
a var
a var/account
a var/at
a var/audit
a var/backups
a var/crash
a var/cron
a var/db
a var/empty
a var/heimdal
a var/log
I was expecting only /var/named/[all those files]
The goal is to tar only /var/named, /var/log, /var/cron
and /var/at such that one could take the resulting tar file and
unpack it over the new /var.
I was under the impression from the man page that
--include's caught only what was named in the pattern and
--exclude's passed everything but the pattern.
I think the --exclude directive has worked before but
--include is either not doing anything or works completely
differently that what I was expecting.
Any ideas are appreciated.
Martin McCormick WB5AGZ Stillwater, OK
Systems Engineer
OSU Information Technology Department Telecommunications Services Group
More information about the freebsd-questions
mailing list