Using mv to rename files on terminal ended up with lost files
If you have a directory/folder of JPEG files that have either a .jpg and or .JPG extension and you want to change the extension to .jpeg, then in Terminal, use the following compound command after changing directory cd ... to the directory containing the JPEG files:

for f in *.[jJ][pP][gG]; do mv -n "$f" "${f%.*}.jpeg"; done