title: copy files from one location to another
body: <p>I am trying to create a directory and subdirectories and copy files from on one location to another location. The following code works but it doesn't create a parent directory(10_new) if there are sub directories. I am trying to copy all the contents(including subdirectories) from <code>"c:\\sourceLoc\\10"</code> to <code>"c:\\destLoc\\10_new"</code> folder. If <code>"10_new"</code> doesn't exist then I should create this folder. Please assist. </p>
  
  <pre><code>string sourceLoc = "c:\\sourceLoc\\10";
  string destLoc = "c:\\destLoc\\10_new";
  
  foreach (string dirPath in Directory.GetDirectories(sourceLoc, "*", SearchOption.AllDirectories))
  {
      Directory.CreateDirectory(dirPath.Replace(sourceLoc, destLoc));
      if (Directory.Exists(sourceLoc))
      {
           //Copy all the files
           foreach (string newPath in Directory.GetFiles(sourceLoc, "*.*", SearchOption.AllDirectories))
               File.Copy(newPath, newPath.Replace(sourceLoc, destLoc));
      }
  }
  </code></pre>