J
Janiek Buysrogge
Hello,
Maybe this has been covered in the past in this group, but I wasn't
able to find any references. If it has been covered, please provide me
with a link of some sort.
I'm trying to rename a directory, eg.: C:\TestDir\Dirname1 to
C:\TestDir\dirname1, as you can see, this is only changed to
lowercase.
This is the code::
string dir = "C:\TestDir\Dirname1";
DirectoryInfo di = new DirectoryInfo(dir);
string newDirName = di.Name.ToLower();
string newPath = "C:\\TestDir\\" + newDirName;
//di.MoveTo(newPath);
Directory.Move(di.FullName, newPath);
This throws the exception:
Could not rename dir: C:\TestDir\Dirname1 to: C:\TestDir\dirname1
because of the following reason:
Source and destination path must be different.
I'm also looking at P/Invoke with the functions in shell32 to to it,
but that seems overkill...
Any idea's ?
Thanks in advance,
JB
Maybe this has been covered in the past in this group, but I wasn't
able to find any references. If it has been covered, please provide me
with a link of some sort.
I'm trying to rename a directory, eg.: C:\TestDir\Dirname1 to
C:\TestDir\dirname1, as you can see, this is only changed to
lowercase.
This is the code::
string dir = "C:\TestDir\Dirname1";
DirectoryInfo di = new DirectoryInfo(dir);
string newDirName = di.Name.ToLower();
string newPath = "C:\\TestDir\\" + newDirName;
//di.MoveTo(newPath);
Directory.Move(di.FullName, newPath);
This throws the exception:
Could not rename dir: C:\TestDir\Dirname1 to: C:\TestDir\dirname1
because of the following reason:
Source and destination path must be different.
I'm also looking at P/Invoke with the functions in shell32 to to it,
but that seems overkill...
Any idea's ?
Thanks in advance,
JB