File Copy

In this chapter you will learn:

  1. Copying A File by using FileInfo

Copying A File by using FileInfo

using System;//j  a v  a  2s.co m
using System.IO;

public class MainClass
{
  static void Main(string[] args)
  {
    FileInfo MyFile = new FileInfo(@"c:\Projects\Testing.txt");

    MyFile.Create();
    MyFile.CopyTo(@"c:\Folder\Testing.txt");

    //or
    MyFile.CopyTo(@"c:\Folder\Testing.txt", true);
  }
}

Next chapter...

What you will learn in the next chapter:

  1. Copy a file with FileStream
  2. Copy a file using byte array
Home » C# Tutorial » Stream
Stream classes
Text File Read
Text File write
Text File Create
Text File Append
Replace File Content
BinaryReader
BinaryWriter
FileStream Create
FileStream byte read and write
BufferedStream
Compare File
File Copy
File Copy with FileStream
MemoryStream
Object Serialization
String Writer