I have some files and folders that are all in uppercase that I want to rename to their lowercase equivalent. What would be the best way to go about doing this in bash on a Linux system?
As an example I might have:
. |-- FOLDER0 | |-- SUBFOLDERA | `-- SUBFOLDERB `-- FOLDER1 `-- AFILE.TXT
And I want to convert it to:
. |-- folder0 | |-- subfoldera | `-- subfolderb `-- folder1 `-- afile.txt
I can probably write a depth first recursive script to do this (depth first to ensure that files and subfolders are renamed before their parent folder), but I was wondering if there is a better way.
rename might be useful, but it doesn’t seem to support recursion.
find . -depth -print0 | xargs -0 rename -n '$_ = lc $_'
Take out the -n flag once you’re sure that it’s doing what you want.