代码如下
public void ChangeExtension(string folderPath, string exName)
{
DirectoryInfo folder = new DirectoryInfo(folderPath);
string path = folderPath + "/Finish"+ GetNowTime();
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
FileInfo[] fileInfos = folder.GetFiles();
for (int i = 0; i < fileInfos.Length; i++)
{
if (fileInfos[i].Extension.Equals("meta")) continue;
string fileName = System.IO.Path.GetFileNameWithoutExtension(fileInfos[i].FullName);
string desPath = path + "/" + fileName + "." + exName;
File.Copy(fileInfos[i].FullName, desPath);
}
}