To e-mail a suggestion or comment: sam@gilcrist.com Here is very simple way to clean up filenames in C#:
/**********************************************************************
/ Name : CleanFileName
/ Purpose : Remove illegal windows filename characters from a string name
/ Author : R. Sam Gilcrist
/ Date : 29 Apr 09
/*********************************************************************/
using System.Text.RegularExpressions;
using System.IO;
public static string CleanFileName(string sFileName)
{
string pattern = new string(Path.GetInvalidFileNameChars()));
Regex rgx = new Regex(pattern);
string sCleanName = rgx.Replace(sFileName, " ");
return sCleanname;
}