Copying a file with C#

You can use System.IO.File class's Copy static method to copy a file.

System.IO.File.Copy("C:\\Test.txt", "D:\\Test.txt", true)

This code will copy the C:\Test.txt file to D:\ with the same name. And if the target directory contains a file with the same name, it will be overwritten.

Türkçe'si için tiklayin.

Ebook Download
View all
Learn
View all