File.Copy() is a file class method that copies the contents of a file to a file that is created by this function.
File.Copy(string source, string destination)
source: This is the name of the file whose contents we want to copy.
destination: This is the file that will be created by the File.Copy() method and filled with the contents of the file with the name source.
Let’s look at the code below:
Welcome to Edpresso!
First, we create a file called test1.txt and write "Welcome to Edpresso!" inside it.
file1 to file2.