0
我有一些文件夹,当我的程序正在运行时检查。 我删除不必要的文件夹并将选中的文件夹返回到其他目录。移动文件夹到相同的命名文件夹
我的问题是我总是得到一个异常。我真的不知道为什么。 btw:当前表格和新表格具有相同的名称 : 翻译,因为它在德语中:数据无法创建,因为它已经存在。 我的代码:
public void CreateCheckedStructure() {
List<string> checkedDirNew = Program.RemoveTempFolders(GetAllFromDir(Settings.Default.NewFolder));
List<string> checkedDirCurrent = Program.RemoveTempFolders(GetAllFromDir(Settings.Default.CurrentFolder));
foreach(string checkedNew in checkedDirNew){
DirectoryInfo dirInfoNew = new DirectoryInfo(checkedNew);
foreach (string checkedCurrent in checkedDirCurrent) {
DirectoryInfo dirInfoCurrent = new DirectoryInfo(checkedCurrent);
if(dirInfoNew.Name.Equals(dirInfoCurrent.Name)){
string checkedFoldersPath = Settings.Default.CheckedTables + "\\" + dirInfoCurrent.Name;
Directory.CreateDirectory(checkedFoldersPath);
Directory.CreateDirectory(checkedFoldersPath+"\\New");
Directory.CreateDirectory(checkedFoldersPath + "\\Current");
dirInfoCurrent.MoveTo(checkedFoldersPath + "\\Current");
dirInfoNew.MoveTo(checkedFoldersPath + "\\New");
break;
}
}
}
}
我编辑我的问题:) – Ams1