[kwlug-disc] excluding directories in diff

unsolicited unsolicited at swiz.ca
Mon Aug 31 15:16:38 EDT 2009


I can't run samples to know, but perhaps?

Can you grep the output to remove the irrelevant directories and file 
not on path lines?

Can you run rsync in list only mode to tell you what it would do? 
(rsync on the command line / local computer is just a non-server file 
copying / sync utility.) Perhaps rsync provides you with easier 
scriptability in this instance?

Paul Nijjar wrote, On 08/31/2009 2:52 PM:
> 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
> 
> 
> 
> 
> _______________________________________________
> kwlug-disc_kwlug.org mailing list
> kwlug-disc_kwlug.org at kwlug.org
> http://astoria.ccjclearline.com/mailman/listinfo/kwlug-disc_kwlug.org
> 




More information about the kwlug-disc mailing list