using System;
using System.IO;
class Test
{
public static void Main()
{
// Specify the directories you want to manipulate.
string path = @"c:\MyDir";
string subPath = @"c:\MyDir\temp";
try
{
// This operation will not be allowed because there are subdirectories.
Console.WriteLine("I am about to attempt to delete {0}.", path);
Directory.Delete(path);
Console.WriteLine("The Delete operation was successful, which was unexpected.");
}
catch (Exception)
{
Console.WriteLine("The Delete operation failed as expected.");
}
finally {}
}
}