It may be a little indirect, but it should work. You can use find to get a list of files that do not match the pattern, and then "exclude" all of these files:
find ab -type f ! -name 'crazy' -printf '%f\n' | diff -rab -X -
-X - make diff read patterns from stdin and exclude anything that matches. This should work if your files don't have funny characters like * or ? . The only drawback is that your diff will not include the find , so the specified diff not so useful.
(I tested it only with GNU find and diff ).
EDIT
Since only non-GNU find does not have -printf , sed can be used as an alternative:
find ab -type f ! -name '*crazy*' -print | sed -e 's|.*/||' | diff -X - -rab
It also suggests that non-GNU diff has -X , which I don't know.
FatalError Apr 12 2018-12-12T00: 00Z
source share