How to delete folder from an S3 bucket

Use the below command to delete folder named ‘prefix’ and all it’s contents from an S3 bucket

aws s3 rm s3://bucketname/prefix --recursive

See also  How to print only file names from an S3 bucket