How to compare two folders with their files and make sure they are the same

2.6k Views Asked by At

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?

1

There are 1 best solutions below

2
Lewis M On

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.