"Alan T" <alanpltseNOSPA M@yahoo.com.auw rote in message
news:eXcn18kyGH A.4392@TK2MSFTN GP04.phx.gbl...
>I just wonder
c:\temp\\doc\\\ root1\\\
>
it gives me that is valid directory but I need to get rid of the extra
'\'s
>
>The system.io class has a directory exists method
>>
>Directory.Exis ts(path)
>>
>described here:
>>
>http://msdn2.microsoft.com/en-us/lib...ry.exists.aspx
>>
>As long as you have the authenticated rights to check that location it
>will tell you if a path exists.
>>How do I check if the directory path is valid and exists ?
>>>
>>eg.
>>\\myserver\te mp\\\\\\
>>>
>>c:\temp\\doc\ \\\\\root1
>
--
Regards
>
John Timney (MVP)
>
>
"Alan T" <alanpltseNOSPA M@yahoo.com.auw rote in message
news:eXcn18kyGH A.4392@TK2MSFTN GP04.phx.gbl...
>>I just wonder
>c:\temp\\doc\\ \root1\\\
>>
>it gives me that is valid directory but I need to get rid of the extra
>'\'s
>>
>>The system.io class has a directory exists method
>>>
>>Directory.Exi sts(path)
>>>
>>described here:
>>>
>>http://msdn2.microsoft.com/en-us/lib...ry.exists.aspx
>>>
>>As long as you have the authenticated rights to check that location it
>>will tell you if a path exists.
>>>How do I check if the directory path is valid and exists ?
>>>>
>>>eg.
>>>\\myserver\t emp\\\\\\
>>>>
>>>c:\temp\\doc \\\\\\root1
The article explains how to do string manipulation
Basically, if you have a string of several \ where there should be only 1
you can do it like this
string s = @"c:\windows\\m icrosoft.net\\\ framework\\\";
while (s.IndexOf(@"\\ ") -1)
s = s.Replace(@"\\" , @"\");
The @ means treat \ as a backslash, not as an escape character
On Tue, 10 Oct 2006 05:16:45 +0200, Alan T <alanpltseNOSPA M@yahoo.com.au
wrote:
Sorry, I don't follow the article if it helps in my problem.
>
Is there a way to get rid of the extra '\' in the directory string?
>
"John Timney (MVP)" <x_john@timney. eclipse.co.ukwr ote in message
news:XbOdnfKrXK WDN2_ZRVnyhw@ec lipse.net.uk...
>read how to trim here
>>
>http://www.csharphelp.com/archives4/archive616.html
>>
>--
>Regards
>>
>John Timney (MVP)
>>
>>
>"Alan T" <alanpltseNOSPA M@yahoo.com.auw rote in message
>news:eXcn18kyG HA.4392@TK2MSFT NGP04.phx.gbl.. .
>>I just wonder
>>c:\temp\\doc\ \\root1\\\
>>>
>>it gives me that is valid directory but I need to get rid of the extra
>>'\'s
>>>
>>>The system.io class has a directory exists method
>>>>
>>>Directory.Ex ists(path)
>>>>
>>>described here:
>>>>
>>>http://msdn2.microsoft.com/en-us/lib...y.exists..aspx
>>>>
>>>As long as you have the authenticated rights to check that locationit
>>>will tell you if a path exists.
>>>>How do I check if the directory path is valid and exists ?
>>>>>
>>>>eg.
>>>>\\myserver\ temp\\\\\\
>>>>>
>>>>c:\temp\\do c\\\\\\root1
>>>
>>>
Comment