Author Topic: How to programmatically copy files in C#?  (Read 2011 times)


  • Administrator
  • Full Member
  • *****
  • Posts: 69
How to programmatically copy files in C#?
« on: October 24, 2011, 12:31:41 pm »
We can use the namespace System.IO.

Code: (C#)
//Source Code Listing

string srcfile = "c:\\src.txt";
string destfile = "c:\\dest.txt";
System.IO.File.Copy(srcfile, destfile);

System.IO.File.Copy(srcfile, destfile, true);  // true will overwrite the file. 
« Last Edit: November 16, 2011, 04:45:51 pm by kathir »


Disclaimer: This web site is for educational and informational purposes only. Click here to read the Disclaimer.
Content copyright 2010-2014. Kathiresan. All rights reserved.
This page is using SMF version 2.0.1