using System.IO;


public static void RenameDirectory(string originalName, string newName)
{
try
{
// "rename" it
Directory.Move(originalName, newName);
}
catch (IOException ioe)
{
// most likely given the directory exists or isn't empty
Console.WriteLine(ioe.ToString());
}
}


منبع : "C#‎ 3.0 Cookbook™, Third Edition"