Is there a way I can diff a gzipped tarball against an existing directory?
I would like to be able to do it without extracting the data from the tarball.
Mount the tarball as a directory, for example with AVFS. Then use
diff -r on the real directory and the point where the tarball is mounted.
mountavfs diff -r ~/.avfs/path/to/foo.tar.gz\# real-directory
Turns out that GNU tar has diff built in (-d):
$ #Create the archive and a difference: $ echo one>file1;echo two>file2;tar -czf archive.tgz file*;echo changing>>file1 $ tar -dzf archive.tgz file1: Size differs
If you are working with tar that does not have this try:
$ for F in `tar -tzf archive.tgz`;do tar -xzOf archive.tgz $F|diff --brief - $F;done Files - and file1 differ