You can delete the folder by using a loop to delete all the key inside the folder and then deleting the folder.
Here is a program that will help you understand the way it works.
import boto3
s3 = boto3.resource('s3')
bucket = s3.Bucket('aniketbucketpython')
for obj in bucket.objects.filter(Prefix='aniket1/'):
s3.Object(bucket.name,obj.key).delete()
Hope this works!
If you are a beginner and need to know more about Python, It's recommended to go for Python Certification course today.
Thanks!