Skip to main content
2 of 3
deleted 25 characters in body
Kusalananda
  • 355.8k
  • 42
  • 735
  • 1.1k

The -x or --exclude options for GNU diff take a filename globbing pattern that each file and directory will be matched against. If the pattern matches a particular name, that name is excluded from comparison.

The pattern is applied to the basename of files and directories, not to pathnames, which means that to exclude your ignoreme directory, you would use

diff -qr --exclude=ignoreme ...

This would also exclude any other name that happens to be ignoreme.

This is similar to the way that --exclude and --exclude-dir works in GNU grep when running grep recursively, although the GNU grep manual explains this better.

The info documentation for GNU diff spells it out:

-x PATTERN
--exclude=PATTERN
When comparing directories, ignore files and subdirectories whose basenames match PATTERN.

Kusalananda
  • 355.8k
  • 42
  • 735
  • 1.1k