#!/bin/bash function print_help() { bn=`basename $0` cat <-Key or the -Key!" >&2 echo "Or press Ctrl-C to abort." >&2 echo "" continue fi ;; *) echo "" echo "What? $answer?" >&2 echo "Please press the -Key or the -Key!" >&2 echo "Or press Ctrl-C to abort." >&2 echo "" continue ;; esac break done return $retval } ORIGINAL_DIR="" MODIFIED_DIR="" if test $# -le 1 ; then set -- -h fi while test $# -gt 0 ; do case "$1" in -h|--help) print_help exit 0 ;; *) ORIGINAL_DIR="$1" MODIFIED_DIR="$2" break ;; esac done ORIGINAL_DIR=`echo "$ORIGINAL_DIR" | sed -e 's:/*$::'` MODIFIED_DIR=`echo "$MODIFIED_DIR" | sed -e 's:/*$::'` original_files=`find "$ORIGINAL_DIR" -type f` for original in $original_files ; do relpath="${original#${ORIGINAL_DIR}/}" reldir=`dirname "$relpath"` basename=`basename "$relpath"` basename_pattern=`echo "$basename" | sed -E -e 's:^[0-9]{8}-[0-9]{6}.[0-9]{6}-:*-*.*-:'` modified_pattern="${MODIFIED_DIR}/${reldir}/${basename_pattern}" modified=`echo $modified_pattern` if ! test -e "$modified" ; then echo "Only in ${ORIGINAL_DIR}: $relpath" >&2 else if ! cmp --quiet "$original" "$modified" ; then echo "File differ: $relpath" >&2 prompt="Display changes?" if ask_yesno -n "$prompt" ; then compare "$original" "$modified" miff:- | display fi fi fi done find "$MODIFIED_DIR" -type f | while read modified ; do relpath="${modified#${MODIFIED_DIR}/}" reldir=`dirname "$relpath"` basename=`basename "$relpath"` basename_pattern=`echo "$basename" | sed -E -e 's:^[0-9]{8}-[0-9]{6}.[0-9]{6}-:*-*.*-:'` original_pattern="${ORIGINAL_DIR}/${reldir}/${basename_pattern}" original=`echo $original_pattern` if ! test -e "$original" ; then echo "Only in ${MODIFIED_DIR}: $relpath" >&2 fi done