I'm making an application, and at a certain point it does the following:
Checks whether a file to be created already exists in a directory (output), if it already exists, it sends it to the Errors folder, otherwise it sends it to the output folder.
It reaches a point where the program transfers the file to the bugs folder, saying that the file does not exist. For example, he just downloaded the file t(49).png
and he reads the same file again!
Funny it is only in some cases that he does it.
My code is this:
if (System.IO.File.Exists(entrada + "t (" + i + ").png")) {
string[] datas1 = Spire.Barcode.BarcodeScanner.Scan(@"C:\QTRACK\Entrada\PNG\t (" + i + ").png");
this.textBox1.Text = datas1[0];
foreach(string code in datas1) {
DirectoryInfo exit = new DirectoryInfo(@"C:/QTRACK/Erro/");
FileInfo[] teste = exit.GetFiles("*.png");
x = teste.Length + 1;
for (c = x; c <= 1000000000; c++) {
if (System.IO.File.Exists(saida + code + ".png")) {
System.IO.File.Move(entrada.ToString() + "t (" + i + ").png", erro + "e" + c + ".png");
} else {
System.IO.File.Move(entrada.ToString() + "t(" + i + ").png", saida + code + ".png");
}
}
}
} else {
}
It gives the error of FileNotFoundExecption
, but it was he who changed the file and is trying to change again.