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?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Amit MohantyPosted Jul 16, 2019, 7:29 AM
if (File.Exists(oldName))
{
File.Copy(oldName, newName, true);
File.Delete(oldName);
}
Option 2:
Microsoft.VisualBasic.FileSystem.Rename(string,string)
Amit GuptaPosted Jul 16, 2019, 4:12 AM
Amit KumarPosted Jul 16, 2019, 12:15 AM