Go to the first, previous, next, last section, table of contents.


Comparing Archive Members with the File System

@UNREVISED

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

@FIXME{what does this actually depend on? i'm making a guess, here.}Depending on the system where you are running tar and the version you are running, tar may have a different error message, such as:

funk: does not exist

@FIXME-xref{somewhere, for more information about format parameters. Melissa says: such as "format variations"? But why? Clearly I don't get it yet; I'll deal when I get to that section.}

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 section Verifying Data as It is Stored.


Go to the first, previous, next, last section, table of contents.