This should be relatively trivial, but I tried for a while without much luck. I have a directory with many directories, each with its own structure and files.
I search all .java files in any directory under the working directory and rename them to a specific name. For example, I would like to name all java files "test.java".
If the directory structure:
./files/abc/src/abc.java ./files/eee/src/foo.java ./files/roo/src/jam.java
I want to just rename to:
./files/abc/src/test.java ./files/eee/src/test.java ./files/roo/src/test.java
Of course, part of my problem is that paths can have spaces. I don't need to worry about renaming classes or anything inside the file, just the file name in place.
If the directory contains more than 1.java file, I do not mind if it is overwritten or instructed to choose what to do (either this is normal, it is unlikely that it contains more than 1 each directory.
What I tried:
Peering at mv and find, but when I connect them, I seem to be doing it wrong, I want to be sure to keep them in my current location and rename, not move.
Thank you, I really appreciate any help.
unix bash rename mv
Theperson
source share