2.03.2014

Powershell - File Renaming

Here is a quick powershell script to tidy files that are not properly formatted for the web.

Get-ChildItem C:\Temp\rename\* -Recurse | Rename-Item -NewName {$_.name -creplace '[^A-Za-z1234567890.]','_' }
Get-ChildItem C:\Temp\rename\* -Recurse | Rename-Item -NewName {$_.name -replace '___','_' }
Get-ChildItem C:\Temp\rename\* -Recurse | Rename-Item -NewName {$_.name -replace '__','_' }