how to find a file then overwrite with a newer version

This should be a simple script, but can't find one with google search.

I just need to find the file that is in many directories, then overwrite that file with a newer version i.e.

find file.jar then overwrite with /root/file.jar

All I get in searches is substitute text with new test inside a file. I got that script.

find . -type f -name file.jar -exec cp /root/file.jar {} \;
1 Like