How to rename a file wihtout using move
my problem with move is that if file already exists it gives me anerror and stopps executiny the code. is there asoluation for this?
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Amit GuptaRank #190 · 12.8K reputationPosted Jul 16, 2019, 12:12 AM EDT
Amit KumarRank #459 · 5.4K reputationPosted Jul 15, 2019, 8:15 PM EDT
Amit MohantyRank #112 · 20K reputationPosted Jul 16, 2019, 3:29 AM EDT
if (File.Exists(oldName))
{
File.Copy(oldName, newName, true);
File.Delete(oldName);
}
Option 2:
Microsoft.VisualBasic.FileSystem.Rename(string,string)