Another way to compare two trees and to report on difference is to use rsync
in --dry-run mode.

Normally rsync is used to make a an archive copy from one directory to
another (sometimes on different hosts)

For example given two directory trees dt and rt, you could "pretend" to
archive them, but only do a dry run, and have rsync report what it would
have done. Note that rsync normally looks for differences and only transfers
the differences. You can get rsync to report what it is doing, either during
the archive with --verbose  (multiple leves even) , or at the end give a
summary with --itemize-changes. You also would need to transpose the source
and destination directories to make sure you cover the differences in both
directions.

(I know the output is a little terse, but at least you can have a succinct
summary of files that need to be investigated)

In the example below the file a/1 has a different timestamp between the two
dirs, and the directory b and file b/7 are in dt, but not rt.

ma...@glenstorm:/tmp$ ls -R dt
dt:
0  1  2  a  b

dt/a:
1  2

dt/b:
7
ma...@glenstorm:/tmp$ ls -R rt
rt:
0  1  2  a

rt/a:
1  2
ma...@glenstorm:/tmp$ rsync --archive --verbose --dry-run   dt/ rt/
building file list ... done
./
a/1
b/
b/7

sent 201 bytes  received 44 bytes  490.00 bytes/sec
total size is 0  speedup is 0.00
ma...@glenstorm:/tmp$ rsync --archive --verbose --verbose --itemize-changes
--dry-run   dt/ rt/
building file list ...
done
delta-transmission disabled for local transfer or --whole-file
.d..t...... ./
.f          0
.f          1
.f          2
.d          a/
>f..t...... a/1
.f          a/2
cd+++++++++ b/
>f+++++++++ b/7
total: matches=0  hash_hits=0  false_alarms=0 data=0

sent 231 bytes  received 74 bytes  610.00 bytes/sec
total size is 0  speedup is 0.00
ma...@glenstorm:/tmp$ rsync --archive --verbose --verbose  --dry-run   dt/
rt/
building file list ...
done
delta-transmission disabled for local transfer or --whole-file
./
0 is uptodate
1 is uptodate
2 is uptodate
a/1
a/2 is uptodate
b/
b/7
total: matches=0  hash_hits=0  false_alarms=0 data=0

sent 231 bytes  received 74 bytes  610.00 bytes/sec
total size is 0  speedup is 0.00
ma...@glenstorm:/tmp$ rsync --archive --itemize-changes --dry-run   dt/ rt/
.d..t...... ./
>f..t...... a/1
cd+++++++++ b/
>f+++++++++ b/7
ma...@glenstorm:/tmp$ rsync --archive --verbose --verbose  --dry-run   dt/
rt/
building file list ...
done
delta-transmission disabled for local transfer or --whole-file
./
0 is uptodate
1 is uptodate
2 is uptodate
a/1
a/2 is uptodate
b/
b/7
total: matches=0  hash_hits=0  false_alarms=0 data=0

sent 231 bytes  received 74 bytes  610.00 bytes/sec
total size is 0  speedup is 0.00
ma...@glenstorm:/tmp$ rsync --archive --verbose --verbose --itemize-changes
--dry-run   dt/ rt/
building file list ...
done
delta-transmission disabled for local transfer or --whole-file
.d..t...... ./
.f          0
.f          1
.f          2
.d          a/
>f..t...... a/1
.f          a/2
cd+++++++++ b/
>f+++++++++ b/7
total: matches=0  hash_hits=0  false_alarms=0 data=0

sent 231 bytes  received 74 bytes  610.00 bytes/sec
total size is 0  speedup is 0.00

Regards, Martin

[email protected]


On Wed, Jan 21, 2009 at 1:10 PM, Daniel Pittman <[email protected]> wrote:

> david <[email protected]> writes:
>
> > I have a directory tree, plus an approximate copy of the same tree.
> > du reports 35mb for one and 36 for the other. They are quite complex
> > trees.
> >
> > My task is to figure out where and why they are different. Is there a
> > simple way to do this? A kind of diff for directories/files/filesizes.
>
> ] apt-cache show komparator
> Package: komparator
> Priority: optional
> Section: kde
> Installed-Size: 1252
> Maintainer: Debian KDE Extras Team <[email protected]
> >
> Architecture: amd64
> Version: 0.9-1
> Depends: kdelibs4c2a (>= 4:3.5.8.dfsg.1-5), libc6 (>= 2.7-1), libgcc1,
> libqt3-mt (>= 3:3.3.8b), libstdc++6 (>= 4.1.1-21)
> Filename: pool/main/k/komparator/komparator_0.9-1_amd64.deb
> Size: 486170
> MD5sum: 0f1148b7ce4fd922f8255cbc9c8525ff
> SHA1: 00f1f3a7368949602f06dc2c832e36ab84cb4c4d
> SHA256: 5d5e2b5cf644a3287a037a3fdb30e87d2d128e6762aa42d1c0a38f2c4836d614
> Description: directories comparator for KDE
>  Komparator is an application that searches and synchronizes two
> directories.
>  It discovers duplicate, newer or missing files and empty folders. It works
> on
>  local and network or kioslave protocol folders.
> Homepage: http://komparator.sourceforge.net
> Tag: implemented-in::c++, interface::x11, role::program, scope::utility,
> suite::kde, uitoolkit::qt, use::scanning, use::synchronizing,
> works-with::file, x11::application
>
> I presume there is a GNOME based equivalent, but that might help if a
> trivial diff doesn't.
>
> Regards,
>         Daniel
> --
> SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
> Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
>
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to