using System.IO;
/// <summary>
/// 图片从一个文件夹移到另一个文件夹
/// </summary>
/// <param name="oldPath">图片所在的旧路径</param>
/// <param name="newPath">图片保存的新路径</param>
public void Replace(string oldPath, string newPath)
{
DirectoryInfo di = new DirectoryInfo(oldPath);
FileInfo[] ff = di.GetFiles();
string Name = "";//具体图片文件名
foreach (FileInfo temp in ff)
{
Name = temp.Name;//取文件名
try
{
string path1 = oldPath + Name;
string path2 = newPath + Name;
File.Move(path1, path2);
}
catch (Exception ex)
{
//报错记录
}
}
}