title: Python way of setting a s3 subdirectory path and deleting it using boto
body: <p>I have a path like below:</p>
  <pre><code>s3://edl-landing/lu/hello2/  
  </code></pre>
  <p>Under which I have two tables as shown below:</p>
  <p><a href="https://i.stack.imgur.com/KhX1N.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KhX1N.png" alt="Path" /></a><br />
  Now, each table has <code>parquet</code> data in the below folders format:</p>
  <p><a href="https://i.stack.imgur.com/2Bg5O.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2Bg5O.png" alt="format" /></a></p>
  <p>Now, I want to delete the data for <code>10th and 11th November</code>. So, below is my python code using the <code>boto</code> client but it doesn't delete the objects from <code>S3</code>. I don't get any errors. Also, I tried various solutions from <a href="https://stackoverflow.com/questions/11426560/amazon-s3-boto-how-to-delete-folder">this link</a> but it also doesn't delete the actual data from S3.</p>
  <pre><code>prefix = &quot;lu/hello2/&quot;
  s3 = boto3.resource('s3')
  bucket = s3.Bucket(name=&quot;edl-landing&quot;)
  FilesNotFound = True
  blankList=[]
  for obj in bucket.objects.filter(Prefix=prefix):
       #print(obj.key)
       blankList.append(obj.key.split('/')[2])
  blankList = set(blankList) // 2 names
  while (&quot;&quot; in blankList):
    blankList.remove(&quot;&quot;)
  datesList = ['2020-11-10','2020-11-11']
  for i in blankList:
    for j in datesList:
      path = &quot;s3://edl-landing/lu/hello2/&quot;+i+&quot;/edl_load_ts=&quot;+j+&quot;/&quot;
      print(path)
      bucket.objects.filter(Prefix=path).delete()
      print(&quot;All the objects have been deleted for the mentioned dates...&quot;)
  </code></pre>
  <p>Where am I going wrong? I am running it via an EC2 instance.</p>