How can I determine if a subdirectory exists in C#?
In C#, how can one determine if a subdirectory exists?
Is this开发者_如何学编程 neccesary when calling CreateSubDirectory
?
if(System.IO.Directory.GetDirectories(path).Length>0)
{
//if this condition is true-->> Directory has sub-sirectories
}
If the subdirectory already exists, this method does nothing.
http://msdn.microsoft.com/en-us/library/h8dtw1d6.aspx
Use Directory.Exists
to check if it exists
http://msdn.microsoft.com/en-us/library/system.io.directory.exists.aspx
Do you need this?
if(Directory.Exists(path))
{
// This path is a directory
ProcessDirectory(path);
}
Use System.IO.Directory.Exists
. MSDN is your friend :)
System.IO.Directory.Exists
精彩评论