From owner-freebsd-questions@FreeBSD.ORG Wed Sep 12 05:09:35 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 757F1106564A for ; Wed, 12 Sep 2012 05:09:35 +0000 (UTC) (envelope-from kline@thought.org) Received: from p3plsmtpa06-08.prod.phx3.secureserver.net (p3plsmtpa06-08.prod.phx3.secureserver.net [173.201.192.109]) by mx1.freebsd.org (Postfix) with ESMTP id 512288FC0A for ; Wed, 12 Sep 2012 05:09:35 +0000 (UTC) Received: from ethic.thought.org ([209.180.213.209]) by p3plsmtpa06-08.prod.phx3.secureserver.net with id y56y1j0064XeM010156zv5; Tue, 11 Sep 2012 22:06:59 -0700 Date: Tue, 11 Sep 2012 22:06:58 -0700 From: Gary Kline To: kpneal@pobox.com Message-ID: <20120912050658.GA11860@ethic.thought.org> References: <20120911213804.GA9817@ethic.thought.org> <20120912011443.5df17cf2.freebsd@edvax.de> <20120912002408.GA10496@ethic.thought.org> <20120912011813.GA2305@neutralgood.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120912011813.GA2305@neutralgood.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: FreeBSD Mailing List 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 05:09:35 -0000 On Tue, Sep 11, 2012 at 09:18:13PM -0400, kpneal@pobox.com wrote: > On Tue, Sep 11, 2012 at 05:24:08PM -0700, Gary Kline wrote: > > On Wed, Sep 12, 2012 at 01:14:43AM +0200, Polytropon wrote: > > > 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. > > > 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 there isn't anything that can compare entire dirs, it looks like > > it's time to hack a small program. tx, polyt. > > Unix was originally created to do text manipulation. No need for a new > program when you can do it from the command line. > > cd dir1 ; cksum * | sort > /tmp/dir1-cksum > cd dir2 ; cksum * | sort > /tmp/dir2-cksum > > diff /tmp/dir?-cksum > > Don't forget to remove temporary files when you are done. > > Other useful commands: > cut > paste > > You can use awk to pull out and rearrange columns: > cksum * | awk '{ print $3, $1, $2; }' | sort > > This gives you a little easier diff in case you do have changes. > > Friendly tip: if you did comparisons by hand for 12 hours then you > may have missed something. no, it was several other tasks that I had t o do very carefully by hand. I was going to write an awk script. I figured there were others ways. my desktop is a flavor of linux that i don't know. it seems to be lacking in many common unix binaries; md5 is one that I spent an hour checking. zero. your first way works very well and will serve. many thanks. now I can listen to: /Lectures on the Critique of Pure Reason which is now safely in my home directory in several mp3 files. > > It's a real shame Unix doesn't have a really good tool for comparing > two directory trees. You can use 'diff -r' (even on binaries), but that > fails if you have devices, named pipes, or named sockets in the > filesystem. And diff or cksum don't tell you if symlinks are different. > Plus you may care about file ownership, and that's where the stat > command comes in handy. right. these are things you only discover the hard way. > > Not that I'm volunteering, mind you. I ended up instead writing a > Python script to do copies of filesystems off of old machines I'm > putting to pasture. It's amazing how badly old versions of dump and > tar behave. REmember CP/M and MP/M? I started out with a dual 8085/80888 box with MP/Mand wrote notes and letters that were stored on 8" twin floppies. circa mid-1980's I transferred a boatload of floppies onto my 386 with SVR2 with uucp and others C programs on the 8088 box. it took forever and things keep faulting, but I got it done. eventually. > -- > Kevin P. Neal http://www.pobox.com/~kpn/ > > "I like being on The Daily Show." - Kermit the Frog, Feb 13 2001