This is a powershell script that removes or renames special characters from files or folder.
Very useful if you are going to upload a lot of files to SharePoint or OneDrive and you files contains illegal characters.
$folder = ‘c:\mytest’
Get-ChildItem $folder -Recurse | ? {$_ -match ‘%|#|_’} | sort psiscontainer, {$_.fullname.length * –1} | % {ren $_.FullName $($_.name -replace ‘%|#’ -replace ‘_’, ‘ ‘)}