[kwlug-disc] excluding directories in diff

Paul Nijjar paul_nijjar at yahoo.ca
Mon Aug 31 14:52:58 EDT 2009

Say I have two directory structures: 




I want to make a unified diff of these, with the following conditions:

0. don't diff files in the proj2/images/ directory (but do diff in

1. be able to run this same command configuration with files in
/home/bonzo (or /usr/local/bin/blah or whereever) without changing the
configuration file. 

Assuming I am in /home/pnijjar/stuff, I can run 

diff -Naur orig new 

and get a unified diff with all files. If I make an exclude file with
the contents 


and run it as 

diff -Naur --exclude-from=excludes orig new 

then I can get a diff with NONE of the images. What I can't do is
something like this


and have it selectively exclude images. I have tried things like


and others, but I can't get anything to work. 

The diff documentation says that the syntax is shell pattern syntax,
as opposed to regexp syntax. So I guess I just don't understand shell
patterns well. 

I would be fine with using another kind of diff, provided that: 
  0. I can run it from the command line
  1. It produces human-readable output
  2. It has a corresponding patch utility

Any ideas? Maybe I am barking up the wrong tree hoping to match
prefixes with wildcards. But it seems that if I put any kind of slash
in the exclusion file then things break. 

- Paul

More information about the kwlug-disc mailing list