private static string CreateValidFileName( string Filename )
{string invalidChars = Regex.Escape( new string( Path.GetInvalidFileNameChars() ) );
string invalidReStr = string.Format( @"[{0}]+", invalidChars );
return Regex.Replace( Filename , invalidReStr, "_" );}
All the question that scared me now i am trying to scare them .. so that they cant scare others :)
Wednesday, May 4, 2011
Removing invalid characters from file name and making file valid.
Subscribe to:
Post Comments (Atom)
Featured Posts
How to Auto-Terminate Frozen and Hung Apps in Windows
We have all been there. You are in the middle of an important project or a gaming session, and suddenly, your screen freezes. The dreaded ...
-
public struct CoOrds { public int x, y; public CoOrds( int p1, int p2) { x = p1; y = p2; } }
-
Manage timer jobs You can check the status of a timer job and edit the timer job definition. For the general administration of ...
Where do Regex, Path come from?
ReplyDelete