How to compare two directories using diff while ignoring non-existing files? How to compare two directories using diff while ignoring non-existing files? linux linux

How to compare two directories using diff while ignoring non-existing files?


It prints a bunch of lines like

Only in dir1/blah: blah

right? So just throw them away with grep.

LC_ALL=C diff ... | grep -v '^Only in'

The LC_ALL=C is to make sure that the standard "Only in" message will be printed, not any translation.


Easiest way I found is to use:

diff -N -q <dir1> <dir2>