title: Counting amount of copied files in C#
body: <p>I have a computer list that I am copying files to.</p>
  
  <p>I am attempting to create a label that shows which computer is being copied to at the time. For ex: "Copying to computer1... (x of 10)", where 10 is based on the amount of lines in a string array:</p>
  
  <pre><code>var lineCount = File.ReadLines(complist).Count();
  </code></pre>
  
  <p>How do I get the first number (x) to change every time a new file is copied? (1 of 10), (2 of 10), etc...</p>
  
  <p>Here is what my label looks like:</p>
  
  <pre><code>label2.Text = ("Copying to " + @computer + "... ( of " + lineCount + ")");
  </code></pre>
  
  <p>EDIT: Here is my copy operation. The files are copied to each remote system.</p>
  
  <pre><code>        string complist = openFileDialog2.FileName;
          string patch = textBox2.Text;
          string fileName = patch;
          string patchfile = Path.GetFileName(fileName);
          var lineCount = File.ReadLines(complist).Count();
  
          foreach (string line in File.ReadLines(complist))
          {
              //Checks if C:\PatchUpdates exists on remote machine. If not, a folder is created.
              if (!Directory.Exists(@"\\" + line + @"\C$\PatchUpdates"))
              {
                  Directory.CreateDirectory(@"\\" + line + @"\C$\PatchUpdates");
              }
  
              //XCOPY patch to every computer
              System.Diagnostics.Process processCopy = new System.Diagnostics.Process();
              ProcessStartInfo StartInfo = new ProcessStartInfo();
              StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
              StartInfo.FileName = "cmd";
              StartInfo.Arguments = string.Format("/c xcopy " + patch + " " + @"\\{0}\C$\PatchUpdates /K /Y", line);
              processCopy.StartInfo = StartInfo;
              processCopy.Start();
              label2.Text = ("Copying to " + @line + "... (" + @num + " of " + @lineCount + ")");
              processCopy.WaitForExit();
  </code></pre>