simple one-liner for mass md5-summing

Stewart C. Russell scruss-rieW9WUcm8FFJ04o6PK0Fg at public.gmane.org
Mon Jun 14 17:51:06 UTC 2004


daniel wrote:
> i've got a directory of about 20 files that i'd like to run an md5 sum on each 
> and put the result into a file

Though you have an answer, the following script will do this 
recursively, for the current directory if no argument is specified, or 
the directory specified as its argument. It's handy for making checksums 
before writing to removable media:

#!/bin/sh
# md5here - do md5sum of tree to stdout; defaults to $PWD,
#  otherwise first arg is top level of tree.

# don't send output to somewhere in the tree or you get
#  a file that fails checksum... ;-)

cd ${1-.}
find `pwd` -type f -print0 | xargs -0 md5sum -b | sed "s,`pwd`/,,;"
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list