Given two directory trees, how can I find out which files differ by content?
The command I use is:
diff -qr dir1/ dir2/
It is exactly the same as Mark's :) But his answer bothered me as it uses different types of flags, and it made me look twice. Using Mark's more verbose flags it would be:
diff --brief --recursive dir1/ dir2/
I apologise for posting when the other answer is perfectly acceptable. Could not stop myself... working on being less pedantic.
Try:
diff --brief --recursive dir1/ dir2/
Or alternatively, with the short flags -qr
:
diff -qr dir1/ dir2/
If you also want to see differences for files that may not exist in either directory:
diff --brief --recursive --new-file dir1/ dir2/ # with long options
diff -qrN dir1/ dir2/ # with short flag aliases
I like to use git diff --no-index dir1/ dir2/
, because it can show the differences in color (if you have that option set in your git config) and because it shows all of the differences in a long paged output using "less".