Date: Tue, 11 Sep 2012 22:06:58 -0700 From: Gary Kline <kline@thought.org> To: kpneal@pobox.com Cc: FreeBSD Mailing List <freebsd-questions@freebsd.org> Subject: Re: cksum entire dir?? Message-ID: <20120912050658.GA11860@ethic.thought.org> In-Reply-To: <20120912011813.GA2305@neutralgood.org> References: <20120911213804.GA9817@ethic.thought.org> <20120912011443.5df17cf2.freebsd@edvax.de> <20120912002408.GA10496@ethic.thought.org> <20120912011813.GA2305@neutralgood.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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 <directory> > > > > > > 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120912050658.GA11860>