Brian

Brian

  • NA
  • 10
  • 0

How to remove the extra '\'s from a file given by the System.IO.Directory.GetFiles()

Sep 2 2011 3:56 PM
Hello,

Forgive me if this is a simple question, I am new to C#. I am enumerating files on a shared network drive and the files that are returned with the System.IO.Directory.GetFiles() are in the format of '\\\\shared folder\\directory\\file'. How can I remove the extra '\'s? I need to use the file and its full path inside of a sql select statement but without the extra '\'s. I tried file.Replace(@"\\",@"\") but it did not work.

Thanks in advance

Answers (3)