I have a function that automatically creates a specified Path by determining whether the String Path is a File or Directory.
Normally, i would use this if the path already exists:
FileAttributes attributes = File.GetAttributes("//Path");
if ((attributes & FileAttributes.Directory) == FileAttributes.Directory)
{
Directory.CreateDirectory("//Path");
}
But what if it doesn't? How to check whether the String Path is a File or Directory if it doesn't exist?