title: Check if file exists in folder or not (SSIS, SDT 2015 and SQL 2016)
body: <p>I need to load multiple files into a SQL table. I have three different formats, CSV, XLSX and XLS, but I will load one type of files at a time, no combination of different file types.</p>
  
  <p>First, I will check in my source folder if the file exists or not. If it exists, load it to table and move to next file. The file checking and selection process must be dynamic. I don't want to hard code the file name in a variable. When the package starts, I need the filename variable to hold the very first file present in the folder each time when I run the package.</p>
  
  <p>If the file is not found in the folder, send mail alert that file doesn't exist.</p>
  
  <p>For example, if I have three files in my folder,</p>
  
  <pre><code>File1.csv
  File2.csv
  File3.csv
  </code></pre>
  
  <p>I run my package and I hard code the file name <code>variable = File1.csv</code> in the first run. My package gets executed successfully and loads the file1 to the table and archives it to the archive folder.</p>
  
  <p>When next time for each loop runs, it looks for variable filename = File1, but it's already archived, so my package will not able to process file2 from the folder. How can I do this properly?</p>