Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

diff has an option --recursive (-r) to do a comparison between two directories (the files inside them). Is there a way to make diff ignore certain sub-directories (eg: .svn)?

$ diff -r src1/ src2/
share|improve this question
up vote 84 down vote accepted

Add --exclude=".svn" as an option like so:

$ diff -r --exclude=".svn" src1/ src2/
share|improve this answer
7  
If you want to exclude multiple items just add another --exclude parameter. – JonMR Jul 12 '11 at 16:02
12  
If you don't want to type --exclude every time use -x ".svn" – logic.town Aug 14 '12 at 9:03
    
--exclude option is also not working on mac os. -x ".svn" works well. – alpert Mar 29 at 11:13
  diff --exclude=.svn ...
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .