title: How to delete files that matches a specific pattern in S3 bucket?
body: <p>I have an S3 bucket that I'm saving CSV files for loading them into Redshift. I'm using <strong>Python</strong> and <strong>Boto3</strong> for this. After loading them into Redshift I want to delete specific files that match a pattern that contains the processing ID for my code.</p>
  
  <p>I'm saving my files into S3 bucket as follows</p>
  
  <pre><code>Redshift{processingID}-table1.csv
  Redshift{processingID}-table2.csv
  Redshift{processingID}-table3.csv
  Redshift{processingID}-table4.csv
  </code></pre>
  
  <p>After processing those files that contains specific ID, I want to delete the processed files from my <strong>S3 bucket</strong>. How do I specify the pattern.</p>
  
  <p>This is the pattern that I'm trying to delete the files from bucket.</p>
  
  <p><code>Redshift11-*.csv</code>. Here <strong>11</strong> is the <strong>processingID</strong>. How do I delete all the files that matches the pattern using <strong>boto3</strong>?</p>
  
  <p>I've come across this.
  <a href="https://stackoverflow.com/a/53836093/4626254">https://stackoverflow.com/a/53836093/4626254</a></p>
  
  <p>But it seems like it is searching for the folder as prefix and not the exact pattern of the file.</p>