A Alan T Aug 25, 2006 #1 How do I check if the directory path is valid and exists ? eg. \\myserver\temp\\\\\\ c:\temp\\doc\\\\\\root1
How do I check if the directory path is valid and exists ? eg. \\myserver\temp\\\\\\ c:\temp\\doc\\\\\\root1
T TonySantolaria Aug 25, 2006 #2 Alan said: How do I check if the directory path is valid and exists ? eg. \\myserver\temp\\\\\\ c:\temp\\doc\\\\\\root1 Click to expand... System.IO.Directory.Exists(@"c:\temp"); cheers
Alan said: How do I check if the directory path is valid and exists ? eg. \\myserver\temp\\\\\\ c:\temp\\doc\\\\\\root1 Click to expand... System.IO.Directory.Exists(@"c:\temp"); cheers
J John Timney \(MVP\) Aug 25, 2006 #3 The system.io class has a directory exists method Directory.Exists(path) described here: http://msdn2.microsoft.com/en-us/library/system.io.directory.exists.aspx As long as you have the authenticated rights to check that location it will tell you if a path exists.
The system.io class has a directory exists method Directory.Exists(path) described here: http://msdn2.microsoft.com/en-us/library/system.io.directory.exists.aspx As long as you have the authenticated rights to check that location it will tell you if a path exists.
A Alan T Aug 28, 2006 #4 I just wonder c:\temp\\doc\\\root1\\\ it gives me that is valid directory but I need to get rid of the extra '\'s
I just wonder c:\temp\\doc\\\root1\\\ it gives me that is valid directory but I need to get rid of the extra '\'s
J John Timney \(MVP\) Aug 28, 2006 #5 read how to trim here http://www.csharphelp.com/archives4/archive616.html
A Alan T Oct 10, 2006 #6 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?
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?
M Morten Wennevik Oct 10, 2006 #7 Hi Alan, 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\\microsoft.net\\\framework\\\"; while (s.IndexOf(@"\\") > -1) s = s.Replace(@"\\", @"\"); The @ means treat \ as a backslash, not as an escape character
Hi Alan, 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\\microsoft.net\\\framework\\\"; while (s.IndexOf(@"\\") > -1) s = s.Replace(@"\\", @"\"); The @ means treat \ as a backslash, not as an escape character