![]() Public static string CleanFileName5(string filename)įoreach (char c in System.IO.Path. Return new String(filename.Except(System.IO.Path.GetInvalidFileNameChars()).ToArray()) ![]() Public static string CleanFileName4(string filename) String regexSearch = string.Format("]", Regex.Escape(regexSearch))) Public static string CleanFileName3(string filename) Var invalid = System.IO.Path.GetInvalidFileNameChars() Public static string CleanFileName2(string filename) Similarly, to delete the 0-byte files in the selected folder tree, click on the Empty Files tab. ![]() From the Empty Files tab, click Mark all Files and then click Delete Files. public static string CleanFileName1(string filename)įile = string.Concat(file.Split(System.IO.Path.GetInvalidFileNameChars(), StringSplitOptions.RemoveEmptyEntries)) The tool will list empty files and folders in separate tabs. UPD: The Issue was unrelated.All of these options do work. and now posting a consolidated question from all the suggestions/answers from other similar questions. I went though almost all of the related questions on this site. Please suggest why this is such an understandable mystery? Am I doing anything wrong? This string is used to create a Filename and need to remove invalid characters and tried following options but none of them works. I have data coming from an nvarchar field of the SQL server database via EF3.5.
0 Comments
Leave a Reply. |