title: How to check if a String Path is a 'File' or 'Directory' if path doesn't exist?
body: <p>I have a function that automatically creates a specified <code>Path</code> by determining whether the <code>String Path</code> is a <code>File</code> or <code>Directory</code>.</p>
  
  <p>Normally, i would use this if the path already <code>exists</code>:</p>
  
  <pre><code>FileAttributes attributes = File.GetAttributes("//Path");
  
  if ((attributes &amp; FileAttributes.Directory) == FileAttributes.Directory)
      {
          Directory.CreateDirectory("//Path");
      }
  </code></pre>
  
  <p>But what if it doesn't? How to check whether the <code>String Path</code> is a <code>File</code> or <code>Directory</code> if it doesn't exist?</p>