bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: diff directories: How do I identify changed files in a script-friend


From: Alan Mackenzie
Subject: Re: diff directories: How do I identify changed files in a script-friendly way?
Date: Tue, 10 Feb 2009 17:18:08 +0000
User-agent: Mutt/1.5.9i

Hi, Bob!

On Sat, Feb 07, 2009 at 12:15:00PM -0700, Bob Proulx wrote:

> Alan Mackenzie wrote:
> > The nearest facility I can find is diff -q ~/orig ~/new, which gives
> > "user friendly" output thusly:

> >     Files ~/orig/cc-defs.el and ~/new/cc-defs.el differ
> >     Files ~/orig/README and ~/new/README differ

> > .  Have I missed a way of getting scriptable output, or do I need to
> > filter out the crud by hand?  Or can a later version give script
> > friendly output?

> I always hate negative information replies that say there isn't a way
> because perhaps there is a better way?  But as far as I know that is
> the best output available from the diff program for your purpose.  You
> would need to filter it.

No problem!  Negative information is orders of magnitude preferable to
innaccurate information or none at all.  ;-)

In the end, I wrote a filtering thing much like the one you suggested.

But it seems a remarkable omission, totally ununix-like.  It would be a
very easy facility to implement, apart from the difficulty of identifying
which command-line flag to use.  -l (like in grep) has already been
taken.  A flag to identify UNchanged files would also be desirable.

> However there are other tools that may provide you with a more direct
> result.  You might want to peek at the old dircmp script that used to
> ship with Unix systems.  Unfortunately I don't have a running copy at
> the moment and can't remember what the output format was like.  But it
> was a script and hackable.

>   http://www.opengroup.org/onlinepubs/007908775/xcu/dircmp.html

> But in the end I would probably use 'rsync' to generate the list you
> want to know about.  It would also need some tinkering but something
> like the following comes to mind.

>   rsync -n --out-format="%n" -aO ~/orig ~/new

> Hope that helps,

It did, very much!  Thanks!

> Bob

-- 
Alan Mackenzie (Nuremberg, Germany).




reply via email to

[Prev in Thread] Current Thread [Next in Thread]