Find files, rename in place unix bash
The GNU version of find
has an -execdir
action which changes directory to wherever the file is.
find . -name '*.java' -execdir mv {} test.java \;
If your version of find
doesn't support -execdir
then you can get the job done with:
find . -name '*.java' -exec bash -c 'mv "$1" "${1%/*}"/test.java' -- {} \;