#!/bin/bash sha1rec () { 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: sha1rec [directory]" exit 1 fi PREVDIR=`pwd` cd $NEXTDIR rm sha1sums.txt for i in *; do if [ -d $i ]; then sha1rec $i else if [ -f $i ]; then if [ "$i" != "md5sums.txt" ]; then if [ "$i" != "sha1sums.txt" ]; then sha1sum $i >> sha1sums.txt fi fi fi fi done cd .. } sha1rec ${1}