参考网址:https://www.cnblogs.com/zpx1986/p/5584619.html
传入值dirSource为需要移动文件所在的路径,dirDestination为移动后的文件所在路径,例如:
MoveFolder("E:/VS_projects/project1/files/WpfApplication3", "E:/VS_projects/project1/WpfApplication3");
//移动文件夹
public bool MoveFolder(string dirSource,string dirDestination)
{
try
{
if (Directory.Exists(dirSource))
{
Directory.Move(dirSource, dirDestination);
}
return true;
}
catch (Exception ex) // 异常处理
{
return false;
}
}