copy a file and overwrite if it already exists - CSharp File IO

CSharp examples for File IO:Text File

Description

copy a file and overwrite if it already exists

Demo Code

using static System.Console;
using static System.IO.Directory;
using static System.IO.Path;
using static System.Environment;
using System.IO;//from   w w  w.  j a  va  2  s. co  m
class Program
{
   static void Main(string[] args)
   {
      File.Copy(
      sourceFileName: "textFile",
      destFileName: "backupFile",
      overwrite: true);
   }
}

Result


Related Tutorials