title: How to determine whether a folder has finished copying c#
body: <p>I have a question: How do I determine whether a folder has finished copying from one location to another?</p>
  
  <p>At the moment my FileSystemWatcher triggers several events as soon as a file within the directory being copied. What I want though, is one single event to be triggered when all the files within that folder has been successfully copied. My code right now looks like this:</p>
  
  <pre><code>static void Main(string[] args)
      {
          String path = @"D:\Music";
          FileSystemWatcher mWatcher = new FileSystemWatcher();
          mWatcher.Path = path;
          mWatcher.NotifyFilter = NotifyFilters.LastAccess;
          mWatcher.NotifyFilter = mWatcher.NotifyFilter | NotifyFilters.LastWrite;
          mWatcher.NotifyFilter = mWatcher.NotifyFilter | NotifyFilters.DirectoryName;
          mWatcher.IncludeSubdirectories = true;
          mWatcher.Created += new FileSystemEventHandler(mLastChange);
          mWatcher.Changed += new FileSystemEventHandler(mLastChange);
  
          mWatcher.EnableRaisingEvents = true;
          Console.WriteLine("Watching path: " + path);
  
  
  
          String exit;
          while (true)
          {
                 exit = Console.ReadLine();
                 if (exit == "exit")
                     break;
  
          }
  
  
      }
  
  
  
      private static void mLastChange(Object sender, FileSystemEventArgs e)
      {
          Console.WriteLine(e.ChangeType + " " + e.FullPath);
      }
  </code></pre>