title: Moving files from one location to another
body: <p>I'm trying to make this program that will move (cut and paste) all files from one directory (a folder) to another directory. In this example, I'm trying to move all the files that are inside the D:\Source folder (has a few files in it) to C:\Source folder (which has no files in it). When I run the program, I get this error.</p>
  
  <p><a href="http://s13.postimg.org/kuufg0gmu/error.jpg" rel="nofollow">http://s13.postimg.org/kuufg0gmu/error.jpg</a></p>
  
  <p>Here is the full source code:</p>
  
  <pre><code>using System.IO;    
  namespace FileManager
  {
      public partial class Form1 : Form
      {
          string sourceDirectory = "";
          //string destinationDirectory = @"C:\Destination";
          string date = "";
          string[] filePaths;
          string destinationPath;
  
          public Form1()
          {
              InitializeComponent();
          }
  
          private void buttonClean_Click(object sender, EventArgs e)
          {
              // Get source directory
              sourceDirectory = textBoxDirectory.Text;
              // Get date of files
              date = textBoxDate.Text;
              // Get file paths
              if (Directory.Exists(sourceDirectory))
              {
                  filePaths = Directory.GetFiles(@sourceDirectory, "*", SearchOption.AllDirectories);
                  foreach (string sourcePath in filePaths)
                  {
                      destinationPath = sourcePath.Remove(0, 1).Insert(0, "C");
  
                      File.Copy(sourcePath, destinationPath);
  
                      //MessageBox.Show(destinationPath);
                  }
              }
              else
              {
                  MessageBox.Show("Directory does not exist.");
              }    
          }
      }
  }
  </code></pre>