cupscale
cupscale copied to clipboard
Error during FilenamePostprocess(): Cannot create a file when that file already exists.
Error during FilenamePostprocess():
Cannot create a file when that file already exists.
Stack Trace: at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.File.InternalMove(String sourceFileName, String destFileName, Boolean checkHost) at Cupscale.Main.Upscale.FilenamePostprocess(String file)
Tell me the exact steps to reproduce the error.
I did a very large batch of 14,000 images, I let it sit at post-processing for 2 hours. there was no progress indicator and I gave up and force quit. I decided to start over and let it run again overnight, but got this error I assume 14,000 times :) How do I clean Install Cupscale (Manually?) Couldn't you just delete the old file if the file exists before create? THANKS! I LOVE CUPSCALE! IT'S GREAT! :)
public static string FilenamePostprocess(string file)
{
if (Program.canceled) return null;
try
{
string newFilename = file;
string pathNoExt = Path.ChangeExtension(file, null);
string ext = Path.GetExtension(file);
newFilename = pathNoExt + "-" + GetLastModelName() + ext;
Logger.Log($"FilenamePostprocess: Moving {file} => {newFilename}");
if (File.Exists(newFilename)) // Added this..
File.Delete(newFilename); // and this.
File.Move(file, newFilename);
newFilename = IoUtils.RenameExtension(newFilename, "jpg", Config.Get("jpegExtension"));
return newFilename;
}
catch (Exception e)
{
Logger.ErrorMessage("Error during FilenamePostprocess(): ", e);
return null;
}
}
the batch of files you were working on were set to read only