title: How can i remove the file name from a path directory string?
body: <p>This is the line:</p>
  
  <pre><code>string f = Path.GetFullPath("c:\\t.txt").Replace(":", "").Replace("\\", "/");
  </code></pre>
  
  <p>I tried something with:  string t = f.LastIndexOf("/"); but that's not working.
  f now is: c/t.txt
  I need that f will be only c/
  And if the directory with the file name was: c:\subdir\sub\t.txt
  So in the end f should be: c/subdir/sub without the t.txt in the end.</p>
  
  <p>I tried this now:</p>
  
  <p>The problem is that when i'm doing:</p>
  
  <pre><code>f.TargetFolder = Path.GetDirectoryName(txf);
  f.TargetFolder = Path.GetFullPath(txf).Replace(":", "").Replace("\\", "/");
  </code></pre>
  
  <p>the second line with the Replace leave me with C/test.txt I tried to make only replace for the string it self without GetFullPath only fro the txf but same result in TargetFolder i have c/test.txt and i need to be with only c/ The line with the Replace is not good it's not giving me the result i need.</p>