string[] a = Directory.GetDirectories("d:\\");
try
{
Directory.Move(a[0], a[1]);
MessageBox.Show("The directory move is complete.");
}
catch (ArgumentNullException)
{
MessageBox.Show("Path is a null reference.");
}
catch (System.Security.SecurityException)
{
MessageBox.Show("The caller does not have the " +
"required permission.");
}
catch (ArgumentException)
{
MessageBox.Show("Path is an empty string, " +
"contains only white spaces, " +
"or contains invalid characters.");
}
catch (System.IO.IOException)
{
MessageBox.Show("An attempt was made to move a " +
"directory to a different " +
"volume, or destDirName " +
"already exists.");
}
با این کد هم امتحان کردم که همش کچ آخری رو انتخاب می کنه و اصلا چیزی رو move نمی کنه.