title: Delete multiple s3 bucket files with Last Modified date condition
body: <p>How do you delete multiple S3 files with <strong>Last Modified</strong> date condition? </p>
  
  <p>I have this folder structure on s3.</p>
  
  <ul>
  <li>dentca-lab-dev-sample
  
  <ul>
  <li>2019-03-13
  
  <ul>
  <li>file1 Last modified: Mar 13, 2019 2:34:06 PM GMT-0700</li>
  <li>file2 Last modified: Mar 13, 2019 3:18:01 PM GMT-0700</li>
  <li>file3 Last modified: Mar 13, 2019 2:34:30 PM GMT-0700</li>
  <li>file4 Last modified: Mar 13, 2019 2:32:40 PM GMT-0700</li>
  </ul></li>
  </ul></li>
  </ul>
  
  <p>and wanted to delete a file (this is just a sample) less than  <code>Mar 13, 2019 2:34:30 PM</code></p>
  
  <p>and so I made this bash script but its not working.</p>
  
  <p><code>aws s3 ls --recursive s3://dentca-lab-dev-sample/2019-03-13/ | awk '$1 &lt;= "2019-03-13 14:34:30" {print $4}'</code> </p>
  
  <p>** <code>ls</code> is just for testing. will change it to <code>rm</code></p>
  
  <p>I also have this script for testing</p>
  
  <p><code>aws s3 ls --recursive s3://dentca-lab-dev-sample/2019-03-13/</code></p>
  
  <p>output: </p>
  
  <pre><code>2019-03-13 14:34:06   11656584 2019-03-13/mandibular.stl
  2019-03-13 15:18:01   11969184 2019-03-13/maxillary.stl
  2019-03-13 14:34:30    9169657 2019-03-13/obj.obj
  2019-03-13 14:32:40   15690284 2019-03-13/upperAIO_50005.stl
  </code></pre>
  
  <p>but when I do the <code>awk</code> to make condition doesn't work. Maybe because <code>$1</code> only catches this arugment <code>2019-03-13</code> and im compering it to <code>2019-03-13 14:34:30</code></p>
  
  <p>also tried doing this. 
  <code>awk '$1 $2 &lt;= "2019-03-13 14:34:30" {print $4}'</code> to catch the second argument but still got nothing. Its my first to make a bash btw.</p>
  
  <p>Thank you! I have this as reference btw. 
  <a href="https://stackoverflow.com/questions/51375531/aws-cli-s3-bucket-remove-object-with-date-condition">aws cli s3 bucket remove object with date condition</a></p>