title: how to check if a particular directory exists in S3 bucket using python and boto3
body: <p>How to check if a particular file is present inside a particular directory in my S3? I use Boto3 and tried this code (which doesn't work):</p>
  
  <pre><code>import boto3
  
  s3 = boto3.resource('s3')
  bucket = s3.Bucket('my-bucket')
  key = 'dootdoot.jpg'
  objs = list(bucket.objects.filter(Prefix=key))
  if len(objs) &gt; 0 and objs[0].key == key:
      print("Exists!")
  else:
      print("Doesn't exist")
  </code></pre>