Rename Invalid File Names for Sharepoint or OneDrive Sync
Problem:
You are trying to sync or upload your files to Sharepoint or OneDrive and you get hundreds of errors about illegal file names.
Solution:
Open PowerShell and run this command to change all the invalid characters to a –
Edit the path to match the location of your files
Get-ChildItem C:\full-path-here -Force -Recurse | ? {$_.Name -match “&|\#|~|%|\{|}|\+”} | foreach { $name = $_.Name -replace ‘&|\#|~|%|\{|}|\+’,’-‘; echo $Name}