How can you rename a file in C#?

 Posted by Ddd on 3/6/2011 | Category: C# Interview questions | Views: 9207 | Points: 40
Answer:

Example:

if there is a filename known as aa.txt in C drive and we want to change its name

to bb.txt.

Use this code snippet:

File.Move("c:\\aa.txt","c:\\bb.txt");


You must include the namespace System.IO


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response