I have the following folder structure in S3. Is there a way to recursively remove all files under a certain folder (say foo/bar1 or foo or foo/bar2/1
..)
The voted up answer is missing a step.
Per aws s3 help:
Currently, there is no support for the use of UNIX style wildcards in a command's path arguments. However, most commands have
--exclude "
and" --include "
parameters that can achieve the desired result......... When there are multiple filters, the rule is the filters that appear later in the command take precedence over filters that appear earlier in the command. For example, if the filter parameters passed to the command were" --exclude "*"
--include "*.txt"
All files will be excluded from the command except for files ending with .txt
aws s3 rm --recursive s3://bucket/ --exclude="*" --include="/folder_path/*"