A common issue when working with SharePoint is making sure your filenames and system fields conform to the SharePoint format and no invalid characters are present. This is especially apparent when using PowerShell since PowerShell is a very ’Sharp’ tool and can add some of these files with illegal characters. To combat this I have put together a quick function that you can pass any text and it will clean it and make it “SharePointReady”.
Make-SharePointReady ($filename)
{
$filename = [System.Text.RegularExpressions.Regex]::Replace($filename,"[~`"#%&*:<>?/\{|}.(),]","")
return $filename
}
{Kam}