How can I compare recursively 2 folders with same structure.
git diff from
bash command line?
migrated from stackoverflow.com Sep 30 '12 at 20:31
This question came from our site for professional and enthusiast programmers.
To compare 2 files, we use the diff command. How do we compare 2 directories? Specifically, we want to know what files/subdirectories are common, what are only in 1 directory but not the other use
if you are not interested in file differences use
diff orders its output alphabetically by file/subdirectory name. I prefer to group them by whether they are common, and whether they only exist in the first or second directory. That is why I piped the output of diff through sort in the above command.
Note that by default diff does not reach into the subdirectories to compare the files and subdirectories at that level. To change its behavior to recursively go down subdirectories, add -r.
I hope this helps.
My favourite for a quick glance:
List filenames (ignoring all kinds of whitespace changes).
To see the whole diff in a nice viewer (removing the
You could probably find other (better?) diff tools (meld, k3diff etc.?)
If you want, you can include files 'new' to the set with -N