Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to compare the content of a tarball with a folder

Tags:

compare

diff

tar

How can I compare a tar file (already compressed) of the original folder with the original folder?

First I created archive file using

tar -kzcvf directory_name.zip directory_name 

Then I tried to compare using

tar -diff -vf directory_name.zip directory_name 

But it didn't work.

like image 689
Steve Avatar asked Feb 08 '12 03:02

Steve


People also ask

How do I compare tar files?

execute a tar tvf to list the contents of each file and store the outputs in two different files. then, slice out everything besides the filename and size columns. Preferably sort the two files too. Then, just do a file diff between the two lists.


1 Answers

--compare (-d) is more handy for that.

tar --compare --file=archive-file.tar 

works if archive-file.tar is in the directory it was created. To compare archive-file.tar against a remote target (eg if you have moved archive-file.tar to /some/where/) use the -C parameter:

tar --compare --file=archive-file.tar -C /some/where/ 

If you want to see tar working, use -v without -v only errors (missing files/folders) are reported.

Tipp: This works with compressed tar.bz/ tar.gz archives, too.

like image 175
zzeroo Avatar answered Sep 22 '22 11:09

zzeroo