Copy files from one directory to another directory in C#

How to copy all files and folders from one directory to another directory or location using C#.

Step 1. Add following namespace 
  1. using System.IO;  
Step 2. We can use File.Copy method to copy a file from current location to a new location. We can also change the file name as well. The following code snippet reads all files in Your Path folder. 
 
Note: Replace "Your Path" with the full path of your directory you want to move and "Your Destination" with your new full path.  
  1. public void readfiles()  
  2. {  
  3.     string[] filePaths = Directory.GetFiles("Your Path");  
  4.     foreach (var filename in filePaths)  
  5.     {  
  6.         string file = filename.ToString();  
  7.                   
  8.         //Do your job with "file"  
  9.         string str = "Your Destination"+file.ToString(),Replace("Your Path");  
  10.         if (!File.Exists(str))  
  11.         {  
  12.             File.Copy(file , str);  
  13.         }  
  14.     }  
  15. }  
Here is a detailed tutorial on file class, Working with Files Using File Class In C#