Comparing directories contents

Man-Chicken manchicken at notsosoft.net
Sat Feb 10 15:35:40 UTC 2007


Well, try this...

mkdir a
mkdir b
echo "a" >> a/a.txt
echo "b" >> b/a.txt
touch a/foo.txt

Then try `diff a b` and you'll get...
diff a/a.txt b/a.txt
1c1
< a
---
> b
Only in a: foo.txt

This is saying that In a.txt in both directories, the diff is that a/a.txt 
line 1 is "a" while line 1 in b/a.txt is "b", and alo that "foo.txt" only 
exists in "a".

If you then do...
mkdir a/foo
mkdir b/foo
echo "abc" >> a/foo/bar.txt
echo "123" >> b/foo/bar.txt
echo "123" >> b/foo/foo.txt

And then do `diff -r a b`, you'll get something like...
diff -r a/a.txt b/a.txt
1c1
< a
---
> b
diff -r a/foo/bar.txt b/foo/bar.txt
1c1
< abc
---
> 123
Only in b/foo: foo.txt
Only in a: foo.txt


On Saturday 10 February 2007 08:39, Dotan Cohen wrote:
> On 10/02/07, Man-Chicken <manchicken at notsosoft.net> wrote:
> > Diff works on directories.  If you like something a little more GUI,
> > Emacs will do ediff on directories.
> >
> > On Saturday 10 February 2007 07:49, Dotan Cohen wrote:
> > > I've a very deep set of directories that I backed up. I suspect that
> > > not all the files were properly backed up and I'd like to check that
> > > the differences between directory1 and directory2. Is there some tools
> > > that does this?
>
> With the r and a options? I can't get the expected output on
> known-same and known-different directories.
>
> Dotan Cohen
>
> http://technology-sleuth.com/long_answer/how_much_memory_will_i_need_for_my
>_digital_camera.html http://uldu.com

-- 
~ Man-Chicken <><
(A)bort, (R)etry, (I)nfluence with large hammer.
The number of the beast - vi vi vi




More information about the kubuntu-users mailing list