Tar recursive comparison with the original folder

I have a file .tgzcreated using tar cvzf tartest.tgz tester/*, and if I specify tar with the file tar --list -f tartest.tgz, I have the following structure

 tester/2017-08-02_131404.png
 tester/cfg.pdf
 tester/tests/
 tester/tests/1.png
 tester/tests/2.png
 tester/tests/3.png
 tester/tests/4.png
 tester/tests/5.png

If I compare tar with the source folder using tar -df tartest.tgz tester/*, everything is fine, no problem, no error

If I add the file 20171006_183137.png to the tester folder and try again, I will get an error, as expected:

 tar: tester/20171006_183137.png: Not found in archive
 tar: Exiting with failure status due to previous errors

If I add the file 20171006_183137.png to the tester / tests folder and try again, I will not get errors and empty output.

If I add the -v option during the last test, I just get the list of files in tar.

Is there a way to recursively compare tar with the source folder and subfolders?

+4
1

, tar , .

, --compare (-d) , system, tar , .

, tar -df tartest.tgz tester/*, (!), " ". tar , , .

, , ( diff -r ).

, , .., diff:

diff <(tar -tf tartest.tgz | sort) <(find tester/ | sort)

, .
diff -y comm .

+1

Source: https://habr.com/ru/post/1688893/


All Articles