This is a continuation of a related but separate ask to this question: Linux: rename files in loop while only targeting the first instance of a specific character
This code works exceptionally well for me to replace the first period from filenames such as: 2022-10-07T071101.8495077Z_QueryHistory.txt
for f in *; do mv -v -- "$f" "${f/./_}"; done # replace the first .
However, I need to run this regularly on a directory and I do not want to eventually replace the file extension .txt.
How can I run this command: for f in *; do mv -v -- "$f" "${f/./_}"; done, such that it only runs if it can find two . in the filename.