0

I want to compare two folders(they both have the same zip files). I want to make sure they are exactly the same. How can i achieve that?

user10751590
  • 283
  • 2
  • 4
  • 11

1 Answers1

0

I tend to do a find on the directory, executing a checksum on each file within that directory. I sort the output and then do a final checksum on the sorted output. If the final checksum of each directory is the same, I think it is safe to assume they are the same.

The command I use is

find _dir_ -type f -exec cksum {} \; | sort | cksum

Hope this helps.

Lewis M
  • 550
  • 3
  • 7
  • i tried to compare two folders with the same files so check the file integrity. However the both folders returns different hash value. – user10751590 Dec 05 '18 at 21:16
  • You could skip the last checksum and just redirect the sorted output into two different files. You can then do a diff on those files to see what individual files have different checksums. – Lewis M Dec 06 '18 at 12:49