title: Directory.GetFiles() throws exception - Folder name has spaces at the end not recognized
body: <p>I have a folder name that looks like this:</p>
  
  <pre><code>\\server\pictures\607\27022015\HARD\  //temp dir
  \\server\pictures\607\27022015\HARD\550528  //dir name (two spaces behind)
  macId //a string representative of a folder name (two spaces behind)
  </code></pre>
  
  <p>In my code I get the folder name by doing this:</p>
  
  <pre><code>if (Directory.Exists(tempDirectoryWithoutMac))
                  {
                      var subDirectories = Directory.GetDirectories(tempDirectoryWithoutMac);
  
                      var directoryToSearch = subDirectories.Where(c =&gt; c.Contains(macId.Trim()));
  
                      if (directoryToSearch.Any())
                      {
                          var newDirectory = directoryToSearch.First();
  
                          foreach (string filename in Directory.GetFiles(newDirectory))
                          {
                              var retVal = new BitmapImage(new Uri(filename.TrimEnd()));
  
                              return retVal;
                          }
                      }
                  }
  </code></pre>
  
  <p>If I inspect and then copy and paste the <code>newDirectory</code> into Windows Explorer it takes me to the folder; however, my code throws an exception:</p>
  
  <pre><code>The network path was not found.
  
     at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
     at System.IO.FileSystemEnumerableIterator`1.CommonInit()
     at System.IO.FileSystemEnumerableIterator`1..ctor(String path, String originalUserPath, String searchPattern, SearchOption searchOption, SearchResultHandler`1 resultHandler, Boolean checkHost)
     at System.IO.Directory.GetFiles(String path)
     at URM.ViewModels.CollectionsViewModel.GetImages(String macId, String type)
  </code></pre>
  
  <p>If I try to rename the folder taking out the spaces at the end...Windows says...the source and destination file names are the same.</p>
  
  <p><strong>Edit</strong>
  I'm pasting this path (quotes used to show spaces):</p>
  
  <p>"\\server\pictures\607\27022015\HARD\550528  "</p>