I need to 'correct' some of my MP3 music files that were created with all spaces in the filenames removed. For example, the MP3 file for the song 'I Feel The Earth Move' is named 'IFeelTheEarthMove.mp3' instead of ''I Feel The Earth Move.mp3'. Fortunately all words in the filenames are capitalized, so I can determine where the missing spaces need to be inserted (between two consecutive uppercase letters, or between a lowercase letter and the uppercase letter that immediately follows).
My first attempt was to use this regular expression:
Match: ([A-Za-z])([A-Z])
Replace: \1 \2
I expected this would locate any upper or lowercase letter followed immediately by an uppercase letter, and insert a space between the two letters, like this:
IFeelTheEarthMove.mp3 -> I Feel The Earth Move.mp3
(The above expressions worked as expected using another app called RegexRenamer. Unfortunately that app only lets you rename files one folder at a time, not a viable option for someone looking to rename files spread across hundreds of folders.)
But when I entered the above expressions, it replaced the entire filename with the just the first matching letter pair and inserted space:
IFeelTheEarthMove.mp3 -> I F.mp3
OK, I suppose that makes sense, since that is what the Replace expression says to do. I obviously need to also preserve the 'rest' of the filename before and after each matching letter pair.
So I next tried this:
Match: (.*[A-Za-z])([A-Z].*)
Replace: \1 \2
That did preserve the missing parts of the filename, but didn't exactly do what I wanted:
IFeelTheEarthMove.mp3 -> IFeelTheEarth Move.mp3
A single space was inserted between the last matching letter pair (the 'h' at the end of 'Earth' and the 'M' at the start of 'Move'). But what I wanted was to insert a space between every matching letter pair, not just one.
I suppose I could just apply this renaming multiple times to all of my files -- each 'apply' would insert one more space into each file's filename -- until all of the missing spaces were reinserted. But there must be a better way.
Can anyone suggest Match and Replace expressions that will insert a space between all matching letter pairs while preserving the rest of the filename?
Thanks.