cksum entire dir??

Polytropon freebsd at edvax.de
Wed Sep 12 00:49:03 UTC 2012


On Tue, 11 Sep 2012 17:24:08 -0700, Gary Kline wrote:
> On Wed, Sep 12, 2012 at 01:14:43AM +0200, Polytropon wrote:
> > On Tue, 11 Sep 2012 14:38:04 -0700, Gary Kline wrote:
> > > 
> > > I'm trying to checksum directories as I move them around.
> > > ive read the man page for sum and cksum ... or maybe skimmed 
> > > them.  no joy.  anybody know of a utility to do this?  I've 
> > > got files that are decades old... 
> > 
> > Maybe it's possible to tar the directory (without
> > compression of course) and obtain a checksum of
> > the tar archive?
> > 
> > 	% tar cf - <director> | cksum
> > 
> > But I also tried cksum directly with a directory
> > like
> > 
> > 	% cksum <directory>
> > 
> > and could obtain a checksum - so it _seems_ to work.
> > After alteration of one file within the hierarchy a
> > different result was printed.
> > 
> > Tested on OS version 8.2-STABLE/i386, one year old.
> > 
> 
> 
> 	I think I tried something like your second example last night.
> 	I think I did
> 
> 	% cksum foodir/*

That lets the shell expand * to the content of foodir, making
a final command line like "cksum foodir/file1 foodir/file2"
and so on. If you omit the /* part, the directory will be
checksummed entirely. If you then remove a file or change
it, a different checksum will be printed. At least that is
my interpretation of what I've tested.



> 	if there isn't anything that can compare entire dirs, it looks like
> 	it's time to hack a small program.  tx, polyt.

The Midnight Commander has a function to compare directories
which will also identify _which_ files have changed (unlike
the command "cksum foodir" that will tell you _that_ a file
has been changed) and use the "mark file" function to highlight
those files. It can be accessed by putting one directory into
the left, the other one into the right panel, and then F9 C C
(or Ctrl-X D). You are then presented a selection:

	+---------------- Compare directories -----------------+
	| Select compare method:                               |
	|                                                      |
	|  [ Quick ]  [ Size only ]  [ Thorough ]  [ Cancel ]  |
	+------------------------------------------------------+

Quick = file names, Size only = file sizes, Thorough = file
content.



-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...


More information about the freebsd-questions mailing list