From owner-freebsd-questions@FreeBSD.ORG Wed Sep 12 02:55:24 2012 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A57AD106564A for ; Wed, 12 Sep 2012 02:55:24 +0000 (UTC) (envelope-from bonomi@mail.r-bonomi.com) Received: from mail.r-bonomi.com (mx-out.r-bonomi.com [204.87.227.120]) by mx1.freebsd.org (Postfix) with ESMTP id 4DE8E8FC0C for ; Wed, 12 Sep 2012 02:55:23 +0000 (UTC) Received: (from bonomi@localhost) by mail.r-bonomi.com (8.14.4/rdb1) id q8C2tXvY092152; Tue, 11 Sep 2012 21:55:33 -0500 (CDT) Date: Tue, 11 Sep 2012 21:55:33 -0500 (CDT) From: Robert Bonomi Message-Id: <201209120255.q8C2tXvY092152@mail.r-bonomi.com> To: kline@thought.org In-Reply-To: <20120912002408.GA10496@ethic.thought.org> Cc: freebsd-questions@freebsd.org Subject: Re: cksum entire dir?? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Sep 2012 02:55:24 -0000 > Date: Tue, 11 Sep 2012 17:24:08 -0700 > From: Gary Kline > 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 - | cksum > > > > But I also tried cksum directly with a directory > > like > > > > % cksum > > > > 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. However, if you just want to etablish that the contents of two directories are identical, the 'diff -r -q {dir1} {dir2} might be appropriate.