Date: Tue, 11 Sep 2012 22:50:20 -0700 From: Gary Kline <kline@thought.org> To: Robert Bonomi <bonomi@mail.r-bonomi.com>, j@thought.org Cc: freebsd-questions@freebsd.org Subject: Re: cksum entire dir?? Message-ID: <20120912055020.GD11860@ethic.thought.org> In-Reply-To: <201209120255.q8C2tXvY092152@mail.r-bonomi.com> References: <20120912002408.GA10496@ethic.thought.org> <201209120255.q8C2tXvY092152@mail.r-bonomi.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Sep 11, 2012 at 09:55:33PM -0500, Robert Bonomi wrote:
>
> > Date: Tue, 11 Sep 2012 17:24:08 -0700
> > From: Gary Kline <kline@thought.org>
> > Subject: Re: cksum entire dir??
> >
> > 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/*
> >
> > and had to compare each file from another file I was copying from.
> > it was tiresome to check each of dozens of files tho. I was here at
> > desk for something obscene -- over 12 hrs. getting my new [slightly
> > used:)] computer back to normal.
>
> If you'd say _what_ you are trying to accomplish, as distinct from
> _how_ you are attempting to do things, people might be able to
> suggest a "sensible" answer.
>
> Taking what you asked _literally_, 'tar . -cf - | cksum' answers the question.
> Although 'find . -exec cat {} \; | cksum' may be closer.
below, is what is easiest to script ... this was kevin's idea, simple
and straight foreward. the only trick is that in several cases I have
to type [[ ot alias ]] prefix strings like
"/home/ethic/usr/home/kline" before I get into the breadth or depth of
my directories ...
>
> However, if you just want to etablish that the contents of two directories
> are identical, the 'diff -r -q {dir1} {dir2} might be appropriate.
>
>
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120912055020.GD11860>
