subhadeep123
Programmer
In C# it is also possible.
The FileSystem class is in the namespace 'Microsoft.VisualBasic' and 'Microsoft.VisualBasic.FileIO'.
Those namespaces are in Microsoft.VisualBasic.dll library.
In your C# project, you need to add the reference to that
.dll by from the .NET section of the Add Reference dialog
and selecting Microsoft.VisualBasic
After that, you use that class as follows:
Microsoft.VisualBasic.FileSystem.Rename("D:/ABC/glass.jpg", "D:/ABC/glass1.jpg");
Or
Microsoft.VisualBasic.FileIO.FileSystem.Rename("D:/ABC/glass.jpg", "D:/ABC/glass1.jpg");
This snippet works for both file and folder renaming.
One good news, this is to the most extent is failsafe.
For example if you open a file/folder, then also you can
rename without any exception
The FileSystem class is in the namespace 'Microsoft.VisualBasic' and 'Microsoft.VisualBasic.FileIO'.
Those namespaces are in Microsoft.VisualBasic.dll library.
In your C# project, you need to add the reference to that
.dll by from the .NET section of the Add Reference dialog
and selecting Microsoft.VisualBasic
After that, you use that class as follows:
Microsoft.VisualBasic.FileSystem.Rename("D:/ABC/glass.jpg", "D:/ABC/glass1.jpg");
Or
Microsoft.VisualBasic.FileIO.FileSystem.Rename("D:/ABC/glass.jpg", "D:/ABC/glass1.jpg");
This snippet works for both file and folder renaming.
One good news, this is to the most extent is failsafe.
For example if you open a file/folder, then also you can
rename without any exception