def download_dir(client, resource, dist, local='/tmp', bucket='your_bucket'):
    paginator = client.get_paginator('list_objects')
for result in paginator.paginate(Bucket=bucket, Delimiter='/', Prefix=dist):
    if result.get('CommonPrefixes') is not None:
        for subdir in result.get('CommonPrefixes'):
            download_dir(client, resource, subdir.get('Prefix'), local, bucket)
if result.get('Contents') is not None:
    for file in result.get('Contents'):
        if not os.path.exists(os.path.dirname(local + os.sep + file.get('Key'))
            ):
            os.makedirs(os.path.dirname(local + os.sep + file.get('Key')))
resource.meta.client.download_file(bucket, file.get('Key'), local + os.sep +
    file.get('Key'))
Boto3 to download all files from a S3 Bucket