In C# how can I prepare a string to be valid for windows directory name
<p>I am writing a C# program which reads certain tags from files and based on tag values it creates a directory structure.</p>

<p>Now there could be anything in those tags,</p>

<p>If the tag name is not suitable for a directory name I have to prepare it to make it suitable by replacing those characters with anything suitable. So that directory creation does not fail.
I was using following code but I realised this is not enough.. </p>

<pre><code>path = path.replace("/","-");
path = path.replace("\\","-");
</code></pre>

<p>please advise what's the best way to do it..</p>

<p>thanks, </p>
