FileInfo.CopyTo(String fileName) : FileInfo « System.IO « C# / C Sharp by API






FileInfo.CopyTo(String fileName)

   

using System;
using System.IO;

public class MainClass
{
  static void Main(string[] args)
  {
    FileInfo MyFile = new FileInfo(@"c:\Projects\Testing.txt");

    MyFile.Create();
    MyFile.CopyTo(@"c:\Folder\Testing.txt");

    //or
    MyFile.CopyTo(@"c:\Folder\Testing.txt", true);
  }
}

   
    
    
  








Related examples in the same category

1.new FileInfo(String fileName)
2.FileInfo.Attributes
3.FileInfo.Create()
4.FileInfo.CreationTime
5.FileInfo.Delete
6.FileInfo.Directory
7.FileInfo.FullName
8.FileInfo.LastAccessTime
9.FileInfo.MoveTo(String path)
10.FileInfo.Open
11.FileInfo.OpenRead
12.FileInfo.OpenText
13.FileInfo.OpenWrite()