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?
1 Answer 1
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