Home  >  Article  >  Backend Development  >  Simple implementation method of copying files in C#

Simple implementation method of copying files in C#

高洛峰
高洛峰Original
2017-01-19 13:27:431603browse

The example in this article describes the simple implementation method of copying files in C#. Share it with everyone for your reference. The specific analysis is as follows:

To copy a file in C#, you can first specify the file through FileInfo, and then copy the file to the specified location through the CopyTo method of FileInfo

FileInfo fi = new FileInfo(@"C:\file.txt");
if(fi.Exists)
{
  fi.CopyTo(@"C:\copyfile.txt");
}

Hope this article explains It will be helpful for everyone's C# programming.

For more articles related to the simple implementation method of copying files in C#, please pay attention to the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn