Linux is definitely your best bet.
I think there is a software that uses python and can grab the codec information, but you can also use something like avconv to output the information, grab the line you need about the codec, and then convert if it's not h.264.
In linux it would look something like,
##note, pseudocode, run and you might have a no good bad day.
convH264(){
if avconv $1 | grep h.264
then
echo "File $1 is already encoded to h.264"
else
echo "File $1 is not encoded to h.264, converting..."
avconv -i "$1" "$1.mp4" #pseudocode
fi
}
^^ That could be a function, and then you just need to pipe something like find into it.
find . | convH264
Find would list all the files recursively from where you ran 'find .' so avconv would test everything.