Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Compare directories the most efficient way



From: Vincent Lefevre <vincent@xxxxxxxxxx>
Subject: Re: Compare directories the most efficient way
Date: Tue, 25 Oct 2005 10:45:27 +0200

> On 2005-10-25 12:27:28 +0900, Jean Chalard wrote:
> > >  There are two identical directory trees with binary stuff in it but
> > >  with a different prefix for example:
> > >   /home/user/onetree/.
> > >  and
> > >   /home/user/theothertree/.
> > 
> > I think I may have missed something here, because I can't see why
> > something like
> > 
> > for i in onetree/**/*; do cmp -- "$i" "${i/onetree/theothertree}"; done
> > 
> > ...wouldn't work.
> 
> Several problems:
>   * If there's a file in theothertree that doesn't exist in onetree,
>     you won't see the corresponding error.
>   * I think you should use something like onetree/**/*(D^/) to include
>     files starting with a dot, but not directories.
>   * If there are special files (symlinks...), this is even more
>     complicated.
> 
> "diff -r" (possibly with -q) from the diffutils is probably a better
> choice.

Hi,

 yes, indeed....there are dotted files in there...even directories are
 dotted...and not found with the pattern above.

 I didn't choose diff, since I wanted a more common (or is "general"
 the better choice?)  solution in case of haveing the task to feed two
 corresponding files to a program, which "does" something with that
 input.

 keep zshing!
 Meino


 
> -- 
> Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <http://www.vinc17.org/>
> 100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
> Work: CR INRIA - computer arithmetic / SPACES project at LORIA
> 


Messages sorted by: Reverse Date, Date, Thread, Author