EDIT: I purposely posted the first Google result. You obviously Googled as well as your code got it backward. But really, why isn't it this? It's worked since the 1980s. You'll dig it since it uses extra apostrophes.
Edit: Oops, request did not include recursive, the original sample solution did.
FWIW top Google results for "unix recursively rename files" give below solutions (slightly different scenarios but you get the idea). Not particularly shorter, or less cryptic:
<Quote>Y'all are still missing the point. We live in a world where people use CoffeeScript to avoid typing a semicolon.
When you Google a PowerShell problem the Google results come back looking insane. You can play code golf here all you want but even this version looks nuts to outsiders
It's a cultural problem. You don't solve it by shouting subtly-differing versions of your culture, louder. ".</Quote>
You're not getting the point. Powershell is just short, and sometimes shorter if you actually learn it.
"When you Google a PowerShell problem the Google results come back looking insane" - This is a problem with the age of powershell. Bash has been around for ever, so there is lots of good quality content on the web.
Y'all are still missing the point. We live in a world where people use CoffeeScript to avoid typing a semicolon.
When you Google a PowerShell problem the Google results come back looking insane. You can play code golf here all you want but even this version looks nuts to outsiders.
It's a cultural problem. You don't solve it by shouting subtly-differing versions of your culture, louder.
That wasn't what I Googled. And Microsoft is announcing bash and Linux shell subsystems today for Windows so y'all are really missing the point. Maybe dev goes one way and ops goes another. But probably not. I'm not betting on Powershell.
dir -recurse | where {-Not $_.PsIscontainer -AND $_.name -match "_"} | foreach { $New=$_.name.Replace("_"," ") Rename-Item -path $_.Fullname -newname $New -passthru }
EDIT: I purposely posted the first Google result. You obviously Googled as well as your code got it backward. But really, why isn't it this? It's worked since the 1980s. You'll dig it since it uses extra apostrophes.