1837939 Members
2113 Online
110124 Solutions
New Discussion

diff on directories

 
SOLVED
Go to solution
David Peacock
Frequent Advisor

diff on directories

Our programmer says our development binaries
are different than our production binaries.

I am trying to do a
diff -r dir1 dir2
I get some output, but, when it hits the binaries I get binary garbage sent to the
screen.

What is the best way to compare two directories
recursively??

I want to see a list of the names of the files that are different
veni, vidi, vmstat
5 REPLIES 5
KCS_1
Respected Contributor
Solution

Re: diff on directories

Hi~

It's solved from can use command "dircmp".


# man dircmp

# dircmp -s dir1 dir2

have a nice day!!
Easy going at all.
Jonathan Baker
Advisor

Re: diff on directories

I would try somthing like :
cd dir1
for i in `ls -R`
do
rv=`cmp -s $i ../dir2/$i`
if [ $rv -ne 0 ]; then
echo $i differs from ../dir2/$i
fi
done

This assumes that the two directories are in the same parent directory.

Jonathan Baker
Advisor

Re: diff on directories

Patricks reply is much better. My scritp doesn't work too well. Should have tested it before posting.
Sorry.
Steve Post
Trusted Contributor

Re: diff on directories

Patrick's right. This command is great.

Run the "dircmp -s dir1 dir2 > file"
Then vi the file.
The -s supresses listings where the files are the same.
A -d will give diff listings for every file that's different.

I use this to see if somebody changed code in a file buried in a directory structure.

After I have the file, I vi it, then run:
:g/^$/de

...to get rid of all the freakin empty lines.

Steve
harry d brown jr
Honored Contributor

Re: diff on directories


Usually development machines do have different versions of the code, compare to what is in production, thats why you should have a "test" machine. And that's why you should have source code control and release install management.

If your developer made this statement, then make them prove it. If someone told me that they think I have a nail in my car tires, I'm not going to take it to the garage and have every tire examined, I'd want that person to prove it to me first.

live free or die
harry
Live Free or Die