#!/bin/bash # first argument : where files may be missing # second argument : where files may be while read f; do test -z "$(find "$2" -not -iregex ".*$1.*" -name $(basename "$f"))" && echo "Missing $f in $2"; done < <(find "$1" -type f);