title: c# could not get part of file path error
body: <p>I'm attempting to recursively copy all files and directories and here is my class code. I am getting could not find part of path. I'm going to assume it may be because there is about 20 sub directories to directories (paths like \game\resour.zip\shared\effects\materials\ and such.) Any help would be appreciated.</p>
  
  <pre><code>    static IEnumerable&lt;string&gt; GetFiles(string path)
      {
          Queue&lt;string&gt; queue = new Queue&lt;string&gt;();
          queue.Enqueue(path);
          while (queue.Count &gt; 0)
          {
              path = queue.Dequeue();
              try
              {
                  foreach (string subDir in Directory.GetDirectories(path))
                  {
                      queue.Enqueue(subDir);
                  }
              }
              catch (Exception ex)
              {
                  MessageBox.Show(ex.Message);
              }
              string[] files = null;
              try
              {
                  files = Directory.GetFiles(path);
              }
              catch (Exception ex)
              {
                  MessageBox.Show(ex.Message);
              }
              if (files != null)
              {
                  for (int i = 0; i &lt; files.Length; i++)
                  {
                      yield return files[i];
                  }
              }
          }
      }
  </code></pre>