title: Check for (.csv or .dat) file extension among multiple files and if not send alert to the user
body: <p>I am new to SSIS,</p>
  
  <p>Every 30 mins I will receive a single file or multiple files in the Source Directory</p>
  
  <p>I need to loop through these files and check if it has a <code>.csv</code> or <code>.dat</code> extension:  </p>
  
  <ul>
  <li>If it is not: send alert to the user.</li>
  <li>If it is: execute the package</li>
  </ul>
  
  <p><strong>EDIT : I have tried;</strong></p>
  
  <pre><code>Main()
  { 
      try
      {
          string[] filenames;
          filenames = Directory.GetFiles(@"C:Input_Data\");
          string FileExtension = Path.GetExtension("filenames");
          if (FileExtension == ".DAT" &amp;&amp; FileExtension == ".csv") 
              Dts.Variables["FileExist"].Value = 1;
      }
      catch 
      { 
          Dts.Variables["FileExist"].Value = 0; 
      }
  
      Dts.TaskResult = (int)ScriptResults.Success;
  }
  </code></pre>
  
  <p>But even if the file exist with <code>.dat</code> extension, it is returning 0 and sending the alert.</p>