Look at:
man diff
man find
Files that are in both Dir1 and Dir2:
Code:
find "$Dir1/" "$Dir2/" -printf '%P\n' | sort | uniq -d
Files that are in Dir1 but not in Dir2:
Code:
find "$Dir1/" "$Dir2/" "$Dir2/" -printf '%P\n' | sort | uniq -u
man comm
Code:
comm -12 <(ls -F $1) <(ls -F $2)
Or just bash
Code:
name1=${file1##*/}
name2=${file2##*/}
if [[ $name1 == $name2 ]]; then
echo ""$name1" exists in both directories"
fi
Etc.