If you are like me and have uploaded a bunch of files to SharePoint then you have had the weird character issue. Use this Regex to clean it. This can be tweaked to run in PowerShell as well...
////\/:*?"<>|#{}%~&
public static string CleanSPFileName(string fileName)
{
return System.Text.RegularExpressions.Regex.Replace(fileName, "(\\?|\\:|\\~|\\#|\\{|\\}|\\&|%|[|]|\\*|\\?|\\\\|\\/|\\<|\\>|\"+)+", "");
}
Posted
05-07-2008 9:11 PM
by
khofer