I am getting an error that the file already exists. How can i successfully increment to the next letter? if the file with 'A' doesn't exist, the file will be written, but it it does, I get an an error that it exist. i need to go to the next letter if this is recognized. I tried, do loops, while, etc. I am including the code with the error
Code:
string newFileName;
char letter = 'A';
letter = (char)((byte)letter + 1);
if (!File.Exists(dupePathDir))
{
while (true)
{
newFileName = fname + "_" + letter.ToString() + extension;
return newfilename;
}
}
return null;
}