So let's automate that. Solution would be to recursively visit each directory and in case its case is wrong - rename. You can have that in java, I would rather be happy to have that in script, however I am not sure whether scripting cmd or bash port on windows will actually handle that rename sanely.
Fortunately there is nice tool in python that accomplishes the same goal -
os.walk
. Usage is trivial and script is portable to any platform. File system paths can be also abstracted easily with os.path.join
. There is even a method in python string
that checks case of whole content - so you will not write any extra loop iterating over characters. Python handles nicely filtering in list comprehensions - so it is possible to use the condition in for statement.
from os import walk, rename from os.path import join for (dirpath, dirnames, filenames) in walk( join('src', 'main', 'java') ): for d in [f for f in dirnames if f.isupper()]: rename(join(dirpath, d), join(dirpath, d.lower()))As you can see some APIs may be even more developer friendly than what is in Java standard. Now came the difficult part - for some reason git was unable to recognize character case change in filenames. It happens that some default on windows is aligned with os approach to case sensitivity. Making git see the difference is changing its configuration:
git config core.ignorecase false