I am unable to rename a file located in (D drive) using c#. I am getting the error
Exception Details: System.NotSupportedException: The given path's format is not supported.
every time.
I am using
string oldfilename = @"D:\abc\file.txt";
string newfilename = @"D:\abc\tree.txt";
System.IO.File.Move(oldfilename, newfilename);
but I am getting the error on the last line. I also tried changing the first 2 lines to
string oldfilename = "D:\\abc\\file.txt";
string newfilename = "D:\\abc\\tree.txt";
I also ensured that the file "file.txt" exists. Tried to use different location.
I also tried Reading contents of the file.txt, but I am getting same error. I searched all the Questions on SO, But with no luck I could get this issue resolved. I think there is some issue with the ":" that I am using after the drive letter while specifying the path. Please guide me.