for(;;) { try { File.Move(oldName, newName); break; } catch(FileNotFoundException){break;} catch{Thread.Sleep(5000);} }