title: Cannot create a file when that file already exists when using Directory.Move
body: <p>I am trying to move the directory from one location to another location on the same drive. I am getting "<strong>Cannot create a file when that file already exists</strong>" error. Below is my code.</p>
  
  <p>could any one suggest on this?</p>
  
  <pre><code>        string sourcedirectory = @"F:\source";
          string destinationdirectory = @"F:\destination";
  
          try
          {
              if (Directory.Exists(sourcedirectory))
              {
                  if (Directory.Exists(destinationdirectory))
                  {
                    Directory.Move(sourcedirectory, destinationdirectory);
                  }
                  else
                  {
                    Directory.CreateDirectory(destinationdirectory);
                    Directory.Move(sourcedirectory, destinationdirectory);
                  }
              }
  
          }
          catch (Exception ex)
          {
              log(ex.message);
          }
  </code></pre>