How to keep the folder and delete all contents of an S3 bucket prefix

Use the below command to delete all the contents of an S3 bucket folder and not the folder itself.

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

See also  How to drop a constraint in Redshift database