I have a question about the diff command if I want a recursive directory diff but only for a specific file type, how to do that?
I tried using the exclude option but can
The lack of a complementary --include makes it necessary to use such convoluted heuristic patterns as
*.[A-Zb-ik-uw-z]*
to find (mostly) java files!
You can also use find with -exec to call diff:
cd /destination/dir/1
find . -name *.xml -exec diff {} /destination/dir/2/{} \;
The lack of a complementary --include ... .
We can do one workaround, a exclude file with all files but what we want include. So we create file1
with a find all files which don't have extensions that we want include, sed
catch the filename and is just :
diff --exclude-from=file1 PATH1/ PATH2/
For example:
find PATH1/ -type f | grep --text -vP "php$|html$" | sed 's/.*\///' | sort -u > file1
diff PATH1/ PATH2/ -rq -X file1