Re: [Hampshire] diffing a directory structure?

Top Page

Reply to this message
Author: Jim Kissel
Date:  
To: Hampshire LUG Discussion List
Old-Topics: Re: [Hampshire] diffing a directory structure?
Subject: Re: [Hampshire] diffing a directory structure?


Bob Dunlop wrote:
> Hi,
>
> On Sun, Jul 08 at 06:23, Andy Random wrote:
>> I'm looking for a way to diff two directory structures, preferably from
>> the command line and in particular I'd like to compare file permissions
>> between the trees. Any suggestions on the best way to do this?
>
> With Bash (needs the named pipe syntax) how about:
>
> diff <(cd $DIR1 ; find . -print | sort | xargs ls -ld ) \
>      <(cd $DIR2 ; find . -print | sort | xargs ls -ld )

>
> Fiddle with the ls format arguments depending on the metadata you wish
> to compare.


I know this was posted a long time ago, but I also knew I was going to
have to use it or similar. Here is a minor improvement that copes with
file names containing blanks or newlines.

diff <(cd $DIR1 ; find . -print0 | sort | xargs -0 ls -ld ) \
      <(cd $DIR2 ; find . -print0 | sort | xargs -0 ls -ld )



--
People choose Microsoft Windows for their PC in the same manner
that the citizens of Soviet Russia elected the General Secretary
of the Communist Party during the cold war.

Jim Kissel
Open Source Migrations Limited
w: http://www.osml.eu
e: jim.kissel@???
p: +44(0) 8703 301044
m: +44(0) 7976 411 679