title: C# Reading through CSV file to rename multiple files with new names
body: <p>I would like to use a list of old and the corresponding new names in a CSV file(source of CSV is a Excel sheet), in order to rename files. Obviously replace the old name with the new name specified for each case.</p>
  
  <p>For Example:</p>
  
  <pre><code>Find what                                       Replace With
  C:\Users\Documents\Pump Station.doc         C:\Users\Documents\Awesome Pump Station.doc              
  C:\Users\Documents\Pump Selection.doc       C:\Users\Documents\Great Pump Selection.doc
  C:\Users\Documents\Pump Sizing Calc.xlsx    C:\Users\Documents\Hectic Pump Sizing Calc.xlsx
  </code></pre>
  
  <p>I am very new to coding and I am having trouble finishing this off. This is what I have so far. I do not necessarily need to even put the list user interface (which it currently does). Ultimately I would like to loop through the rows in my CSV file, check if the old name specified exists and if so, rename it to the new name specified.</p>
  
  <p>I really appreciate any help in advance and sorry for any rookie errors I may have made in my code below.</p>
  
  <pre><code>public class OldNew
  {
      public string oldFile { get; set; }
      public string newFile { get; set; }        
  }
  
  public static class OldNewService
  {
      public static new List&lt;OldNew&gt;ReadFile(string filepath)
      {
          var lines = File.ReadAllLines(filepath);
  
          var data = from l in lines.Skip(1)
                     let split = l.Split(',')
                     select new OldNew
                     {
                         oldFile = split[0],
                         newFile = split[1],
                         };
  
      return data.ToList();
          }
  }
  
  public partial class MainWindow : Window
  {
      public MainWindow()
      {
          InitializeComponent();
  
          DataContext = OldNewService.ReadFile(@"C:\Users\cch\Documents\Batch Edit\Lookup Table.csv");
      }
  }
  </code></pre>
  
  <p>}</p>