title: DirectoryNotFoundException - Could Not Find Part of the Path
body: <p>I have a console application I built for myself to rename <code>.mp3</code> files I download. This application has worked flawlessly for quite a few months, but is all of a sudden tossing the titled exception at me with one particular directory. Not only is it this one directory, but is happening on only a select number of files - 3 of them were successfully renamed.</p>
  
  <p>Here is my directory path and files:</p>
  
  <p><a href="https://i.stack.imgur.com/OTcsf.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OTcsf.png" alt="enter image description here"></a></p>
  
  <p>Here is a snippet of the directory path where the exception is thrown, along with the exception's message:</p>
  
  <p><a href="https://i.stack.imgur.com/qLDUA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qLDUA.png" alt="enter image description here"></a></p>
  
  <p>And here is my code:</p>
  
  <pre><code>static void Main(string[] args) {
      string dir = @"M:\Temp Downloading Folder";
  
      var files = new DirectoryInfo(dir + @"\Gregory Alan Isakov Discography [2005 - 2013]\Rust Colored Stones").GetFiles("*.mp3").ToList();
  
      foreach (var item in files) {
          if (item.Name.Substring(0, 2).All(char.IsDigit)) {
              //string fullName = item.FullName.Replace("\\", "/");
              string newName = "Gregory Alan Isakov ";
              //exception thrown here
              File.Move(item.FullName, item.FullName.Replace(item.Name.Substring(0, 3), newName));
          }
      }
      Console.WriteLine("Done!");
      Console.ReadKey();
  }
  </code></pre>
  
  <p>I tried changing the path to have <code>/</code> instead of <code>\\</code> with the same result.</p>
  
  <p>According to the <a href="https://msdn.microsoft.com/en-us/library/system.io.directorynotfoundexception(v=vs.110).aspx" rel="nofollow noreferrer">Documentation on MSDN</a>:</p>
  
  <blockquote>
    <p>The exception that is thrown when part of a file or directory cannot
    be found.</p>
  </blockquote>
  
  <p>However, the directory <em>is</em> found and correctly renamed the first 3 files (as depicted in the first image).</p>
  
  <p>Can anyone explain to me why this is happening?</p>