Previous: delete, Up: Advanced tar
(This message will disappear, once this node revised.)
The --compare (-d), or --diff operation compares specified archive members against files with the same names, and then reports differences in file size, mode, owner, modification date and contents. You should only specify archive member names, not file names. If you do not name any members, then tar will compare the entire archive. If a file is represented in the archive but does not exist in the file system, tar reports a difference.
You have to specify the record size of the archive when modifying an archive with a non-default record size.
tar ignores files in the file system that do not have corresponding members in the archive.
The following example compares the archive members rock, blues and funk in the archive bluesrock.tar with files of the same name in the file system. (Note that there is no file, funk; tar will report an error message.)
$ tar --compare --file=bluesrock.tar rock blues funk rock blues tar: funk not found in archive
The spirit behind the --compare (--diff, -d) option is to check whether the archive represents the current state of files on disk, more than validating the integrity of the archive media. For this later goal, See verify.