1

While comparing 2 fairly big directories using diff -rq ... I want to exclude certain file types like tar.gz or error_log.

How do I do that?

4

GNU diff has options for doing this (see manual page):

   -x, --exclude=PAT
          exclude files that match PAT

   -X, --exclude-from=FILE
          exclude files that match any pattern in FILE

The pattern in each case is a glob (* for any number of characters):

diff -rq -x '*.tar.gz' -x '*error_log' foo bar

See for example:

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.