Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Is there a way I can perform a recursive diff of two directories but only compare (in their respective places) files that match a specific filename or filetype predicate?

E.g. I would like to do something like

diff -r dir-a dir-b -filenames *.java, ivy.xml, build.xml

... or even better:

diff -r dir-a dir-b -filetype text

Clearly it is not mandatory to use diff as I suppose an incantation with find and -exec diff might also do the trick (I just don't know how to generate the complementary filepaths in the latter case).

share|improve this question
1  
There's an option to exclude files that match a pattern, I don't see an option to include only files that match the pattern. –  Barmar May 28 '14 at 20:41
1  
All the options specific to comparing directories can be found at gnu.org/software/diffutils/manual/html_node/… –  Barmar May 28 '14 at 20:44

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.