title: How do I create a file AND any folders, if the folders don't exist?
body: <p>Imagine I wish to create (or overwrite) the following file :- <code>C:\Temp\Bar\Foo\Test.txt</code></p>
  
  <p>Using the <a href="http://msdn.microsoft.com/en-us/library/d62kzs03.aspx" rel="noreferrer">File.Create(..)</a> method, this can do it.</p>
  
  <p>BUT, if I don't have either one of the following folders (from that example path, above)</p>
  
  <ul>
  <li>Temp</li>
  <li>Bar</li>
  <li>Foo</li>
  </ul>
  
  <p>then I get an <a href="http://msdn.microsoft.com/en-us/library/system.io.directorynotfoundexception.aspx" rel="noreferrer">DirectoryNotFoundException</a> thrown.</p>
  
  <p>So .. <strong>given a path, how can we recursively create all the folders necessary to create the file .. for that path?</strong>  If Temp or Bar folders exists, but Foo doesn't... then that is created also.</p>
  
  <p>For simplicity, lets assume there's no Security concerns -- all permissions are fine, etc.</p>