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?

U880D
1,21712 silver badges26 bronze badges
asked Nov 14, 2015 at 14:38

1 Answer 1

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:

answered Nov 14, 2015 at 15:01
0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.