title: How to delete S3 key in nested folder?
body: <p>I have a bucket with many subfolders. They are designed like this:</p>
  <p><code>bucket_name/nginx_archives/server_name/server_name_date_time.tar.gz</code></p>
  <p>However, all the oldest files are <code>.csv</code>, and I need to remove them.</p>
  <p>I can see the keys with:</p>
  <pre><code>servers = ['server1', 'server2', 'server3', 'server4', etc, etc]
  
  for server in servers:
     for object in the_bucket.objects.filter(Prefix='nginx_archives/'+server+'/'):
         key = object.key
         if key.endswith('.csv'):
             print(key)
            
  </code></pre>
  <p>It gives me output like this:</p>
  <pre><code>nginx_archives/server1/empty.csv
  nginx_archives/server2/empty.csv
  nginx_archives/server3/empty.csv
  nginx_archives/server4/empty.csv
  nginx_archives/server5/empty.csv
  </code></pre>
  <p><code>key.delete()</code> does not work. How can I delete these keys without manually going through every single folder? There are about 50.</p>
  <p>Trying to use <code>key.delete()</code> gives me:</p>
  <p><code>AttributeError: 'str' object has no attribute 'delete'</code></p>