title: How to delete back up files
body: <p>I need to delete files with ".bak" and ".csv.bak" extensions. I use .net c#.</p>
  
  <p>I tried like this:</p>
  
  <pre><code>        string srcDir = @"D:\Backup";
  
          string[] bakList = Directory.GetFiles(srcDir,".bak");
  
          if (Directory.Exists(srcDir))
          {
              foreach (string f in bakList)
              {
                  File.Delete(f);
              }
          }
  </code></pre>
  
  <p>But when debugging, the bakList array is empty. </p>
  
  <p><code>Directory.GetFiles()</code> is not loading the file names in the array. I cant figure out what is wrong in my coding.</p>