Create the following script.
The names uat
and prod
simply refer to the two filesystems this script was developed to test.
They can be renamed to anything.
#!/bin/bash
uat=`file -bi "/mnt/my_files/${1}"`
prod=`file -bi "/mnt/my_other_files/${1}"`
if [[ "$uat" == "cannot open (No such file or directory)" || "$prod" == "cannot open (No such file or directory)" ]]
then
echo $1 >> /data/errors.txt
elif [[ "$uat" != "$prod" ]]
then
echo $1 >> /data/mismatches.txt
else
echo $1 >> /data/matches.txt
fi
Then use find
to pipe every file through said script:
cd /mnt/my_files
find . -type f -exec /data/compare.sh "{}" \;