I'm trying to use the diff command to see the difference between two directories, recursively.
aDirectory
under directory directory1
and aDirectory
under directory directory2
:
diff "directory1/aDirectory" "directory2/aDirectory"
Each of those have subdirectories and that's fine. For each common subdirectory I get this:
Common subdirectories: directory1/aDirectory/dir and directory1/aDirectory/dir
Because I have so many identically named subdirectories, notification about common subdirectories is annoying and makes the output unreadable.
All I want the diff command to show me are files/subdirectories that are different between those two directories (and their subdirectories), but not the ones that are the same. Is there a switch for that?
You need to supply the -r
option to do a recursive diff. Without it, diff
is telling you that "directory1/aDirectory" and "directory2/aDirectory" both have a subdirectory called "dir". However, it is not looking inside "dir", because you did not ask for recursive diff.
Try
diff -r "directory1/aDirectory" "directory2/aDirectory"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With