Reputation: 1708
I have a folder with with user names as file name. The problem is that some of them are properly formatted and others are not. example
Good = Jane Doe.bmp
Bad = JaneDoe.bmp
What I was thinking is first to find if the name has any space in it. If not then find the first instance of the upper case and add an space.
Any ideas what will the best way to accomplish this?
Upvotes: 1
Views: 200
Reputation: 1
Get-ChildItem | ForEach-Object {
$outfile = $_ -creplace '(\p{Ll})(\p{Lu})', '$1 $2'
Move-Item $_ $outfile
}
Upvotes: 2