Move a file in CSharp
Description
The following code shows how to move a file.
Example
// w w w . ja v a 2s . com
using System;
using System.IO;
public class MainClass
{
static void Main(string[] args)
{
FileInfo MyFile = new FileInfo(@"main.cs");
MyFile.Create();
MyFile.MoveTo(@"c:\MyFolder\Moved Testing.txt");
MyFile.MoveTo(@"C:\MyFolderNew");
}
}