Capitalize the first letter of each word in a filename with powershell
You can use ToTitleCase
Method:
$TextInfo = (Get-Culture).TextInfo
$TextInfo.ToTitleCase("one two three")
outputs
One Two Three
$TextInfo = (Get-Culture).TextInfo
get-childitem *.mp3 | foreach { $NewName = $TextInfo.ToTitleCase($_); ren $_.FullName $NewName }
Yup, it's built into Get-Culture.
gci *.mp3|%{
$NewName = (Get-Culture).TextInfo.ToTitleCase($_.Name)
$NewFullName = join-path $_.directory -child $NewName
$_.MoveTo($NewFullName)
}
Yeah, it could be shortened to one line, but it gets really long and is harder to read.