[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:
/home/pnijjar/stuff/orig/
/home/pnijjar/stuff/orig/proj1/
/home/pnijjar/stuff/orig/proj1/images/
/home/pnijjar/stuff/orig/proj2/
/home/pnijjar/stuff/orig/proj2/images/
and
/home/pnijjar/stuff/new/
/home/pnijjar/stuff/new/proj1/
/home/pnijjar/stuff/new/proj1/images/
/home/pnijjar/stuff/new/proj2/
/home/pnijjar/stuff/new/proj2/images/
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
proj1/images)
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
--
*images*
--
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
--
proj2/images/
--
and have it selectively exclude images. I have tried things like
.proj2/images
*proj2/images*
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