Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What would be a command structure or simple bash script to run to compare all files in one directory with all files in another directory, verifying their data are identical, or not, down to the bit? Needs to be recursive so it also verifies files in subdirectories.

Basically a way to ascertain with confidence that a directory copy or mirror operation has maintained data integrity.

share|improve this question
up vote 3 down vote accepted

Try diff -a -q -r dir1 dir2

See for more.

share|improve this answer
great thanks. I ended up using diff -s -r -q dir1 dir 2 to get a log of identical files as well (to watch progress) – DaveO Sep 13 '12 at 10:52

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.