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

Re: Compare directories the most efficient way



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.

-- 
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