Snippets

Here is your code snippet

Code


move a file with MoveTo

move a file with MoveTo

using System; using System.IO; namespace csharp { class Class1 { static void Main(string[] args) { FileInfo fileInfo = new FileInfo(@"d:\testfile1.txt"); if (File.Exists(@"d:\testfile1.txt ")) { fileInfo.MoveTo(@"e:\test1.txt "); Console.WriteLine("Success"); } } } }