#!/bin/bash md5rec () { if [ -d ${1} ]; then NEXTDIR=${1} echo "descending into $NEXTDIR" fi if [ ! -d ${1} ]; then if [ -d `pwd`/${1} ]; then NEXTDIR=`pwd`/${1} echo "descending into $NEXTDIR" fi fi if [ ! $NEXTDIR ]; then echo "Usage: md5rec [directory]" exit 1 fi PREVDIR=`pwd` cd $NEXTDIR rm md5sums.txt for i in *; do if [ -d $i ]; then md5rec $i else if [ -f $i ]; then if [ "$i" != "sha1sums.txt" ]; then if [ "$i" != "md5sums.txt" ]; then md5sum $i >> md5sums.txt fi fi fi fi done cd .. } md5rec ${1}