I am a newbie and I have searched everywhere for this, I have also tried combining a lowercase renaming command with some regex to get Title Case instead of lowercase but I wasn't very successful.
This command converts everything (files + folders) inside the given folder to lowercase:
while IFS= read -r -d '' file; do mv -b -- "$file" "${file,,}"; done < <(find . -depth -name '*[A-Z]*' -print0)
And this is my attempt at title case, it works, but it is not recursive:
find . -name "*.flac" -print0 | while read -d $'\0' file; do rename 's/(^|[\s\(\)\[\]_-])([a-z])/$1\u$2/g' *; done
Those are just some of my attempts, if there are better, shorter solutions I would pretty much like those instead.
Could you please help me out? Thanks in advance!
EDIT: I forgot to mention, my files look like this: "09 – the Road to Home – Amy MacDonald.flac"; should be renamed to "09 – The Road To Home – Amy Macdonald.flac". Notice how there are already title cased words as well as uppercase letters in the middle of a word.
Best Answer
To use the script below, you do not need more than the ability to paste :)
How to use
rename_title.py
chmod u+x rename_title.py
Run it with the directory to rename as argument:
The script
Examples:
And more complex, excluding
["a", "an", "the", "and", "but", "or", "nor", "at", "by", "for", "from", "in", "into", "of", "off", "on", "onto", "out", "over", "to", "up", "with", "as"]
:becomes:
etc, it simply makes all files and folders (recursively) Title Case, extensions lower case.
EDIT: I have added all articles, conjunctions and prepositions that do not need to be capitalized according to the capitalization rules for song titles.