Re: [SLUG] comparing directory trees

2009-01-21 Thread david



Ken Foskey wrote:

On Wed, 2009-01-21 at 11:15 +1100, david wrote:

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.


rsync using a dry run?

Ken



Nice idea! but unfortunately all the time stamps seem to have changed somewhere 
in the copying process.  Great idea for some situations though.


The problem with kdiff3 and komparator is that they both demand vast amounts of 
k-dependencies that I would rather not install (this is a server). Not sure why 
they need esound-common and many other apparently irrelevant packages, but i'm 
sure there must be a reason.


This worked:
da...@ns:/dir1$ tree -as .  /home/david/test1
da...@ns:/dir2$ tree -as .  /home/david/test2
da...@ns:/home/david$ diff test1 test2 | less

So did this:
da...@ns:/dir1$ ls -as --block-size=1 .  /home/david/test1
da...@ns:/dir2$ ls -as --block-size=1 .  /home/david/test2
da...@ns:/home/david$ diff test1 test2 | less

Then I realised that some files *might* have changed but not changed file size! 
D'uh.


Probably have to risk it.
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] comparing directory trees

2009-01-21 Thread Daniel Pittman
david da...@kenpro.com.au writes:
 Ken Foskey wrote:
 On Wed, 2009-01-21 at 11:15 +1100, david wrote:
 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.

 rsync using a dry run?

 Nice idea! but unfortunately all the time stamps seem to have changed
 somewhere in the copying process.  Great idea for some situations
 though.

You can ask rsync to use checksums only, which should detect only
changed content.

 The problem with kdiff3 and komparator is that they both demand vast
 amounts of k-dependencies that I would rather not install (this is a
 server).

komparator, at least, can work with any KIO path, so you should be able
to compare (for example) sftp://u...@server//path/to/dir1 ...

Most KDE applications, in fact, support remote files that way.

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


Re: [SLUG] comparing directory trees

2009-01-21 Thread Martin Visser
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

martinvisse...@gmail.com


On Wed, Jan 21, 2009 at 1:10 PM, Daniel Pittman dan...@rimspace.net wrote:

 david da...@kenpro.com.au 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 pkg-kde-ext...@lists.alioth.debian.org
 
 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/

Re: [SLUG] comparing directory trees

2009-01-21 Thread jam
On Thursday 22 January 2009 10:00:06 slug-requ...@slug.org.au wrote:
  On Wed, 2009-01-21 at 11:15 +1100, david wrote:
  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.
 
  rsync using a dry run?
 
  Ken

 Nice idea! but unfortunately all the time stamps seem to have changed
 somewhere in the copying process.  Great idea for some situations though.

 The problem with kdiff3 and komparator is that they both demand vast
 amounts of k-dependencies that I would rather not install (this is a
 server). Not sure why they need esound-common and many other apparently
 irrelevant packages, but i'm sure there must be a reason.

forgive me :-) I'm playing the devils advocate
WHY
 that I would rather not install (this is a server

idealogically you don't want to waste a few $ worth of disk space by
idealogically not giving a krap about the $100s that everyone who has read and 
replied to your query has cost?

What have we all learned: don't be stupid use the tools that do the job

A whole suit of other solutions rear their heads, eg knoppix, live CDs, 
MemSticks, but you get the idea

James
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


[SLUG] comparing directory trees

2009-01-20 Thread david

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.


thanks...

David.
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] comparing directory trees

2009-01-20 Thread Bruce
On Wednesday 21 January 2009 11:15:07 david wrote:
 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.

 thanks...

 David.

Hi David,

I've been doing the exact same thing for the last 3 days using kdiff3.

It does the job well enough even though it's intended for source tree 
comparisons.  Just read all the warnings if you are going to try automerging.

hth
bruce
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] comparing directory trees

2009-01-20 Thread Erik de Castro Lopo
david wrote:

 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.

I'm pretty sure the diff program will actually do this.

Have a look at the following options:

  -a  --text
  Treat all files as text.

  -q  --brief
  Output only whether files differ.

  -r  --recursive
  Recursively compare any subdirectories found.

You may also want to try doing ls -lR dirname  dirname.txt on both
directories and then viewing the outputs in a graphical diff program.

HTH,
Erik
-- 
-
Erik de Castro Lopo
-
Christianity has a nasty habit of ignoring the major problems of
our time, including overpopulation and exhaustion of resources,
because  they aren't mentioned in the Bible.
-- Paula L. Craig
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] comparing directory trees

2009-01-20 Thread Owen Townend
2009/1/21 Erik de Castro Lopo mle+s...@mega-nerd.com:
 david wrote:

 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.

 I'm pretty sure the diff program will actually do this.

[snip diff options]

 You may also want to try doing ls -lR dirname  dirname.txt on both
 directories and then viewing the outputs in a graphical diff program.

 HTH,
 Erik
[snip footer]

For a different type of formatted output you could also try something
like tree[0]
$ tree -ah dir1  dir1.out
$ tree -ah dir2  dir2.out
$ diff -wy --left-column dir1.out dir2.out

cheers,
Owen.

[0] `tree` is in its own package by the same name under Ubuntu, I
imagine it is similar for other distros.
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] comparing directory trees

2009-01-20 Thread Daniel Pittman
david da...@kenpro.com.au 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 pkg-kde-ext...@lists.alioth.debian.org
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