title: Python - Download data from specific folder / sub - folder AWS S3
body: <p>I am trying to extract data from AWS S3. The code below helps me download a file. However if the bucket has multiple folders then the below code tries to extract the complete bucket and not a specific folder / sub-folder. How could I modify the below code to extract only a specific file in a folder / sub-folder</p>
  
  <pre><code>from boto3.session import Session
  import boto3
  
  ACCESS_KEY = 'ABC'
  SECRET_KEY = 'XYZ'
  
  session = Session(aws_access_key_id=ACCESS_KEY,
            aws_secret_access_key=SECRET_KEY)
  s3 = session.resource('s3')
  your_bucket = s3.Bucket('bucket_name')
  
  for s3_file in your_bucket.objects.all():
      print(s3_file.key)
  
  your_bucket.download_file('rawdata.xlsx' ,/Users/user/Desktop/folder/')
  </code></pre>
  
  <p>Thanks.</p>