AWS CLI s3 ls command list the bucket objects (file) along with the folder (key) and there is no option to change this behavior. However, you can pipe the output of the AWS CLI command and use programs like awk or sed to get only the folder name from the output as shown below –
1 2 |
## Get file names in your S3 bucket aws s3 ls s3:// |