S3 cli includes non-working

Ok I am very confused about aws cli

I have an S3 bucket:

s3://my-bucket
  directory/
    file1
    file2
  backup-logs-1234
  backup-logs-5678

      

I have verified that the files are in the s3 bucket and I can see them with aws s3 ls s3://my-bucket

I am trying to delete all backup logs in a folder (8000 of them). I have tried every combination of include / exclude I can think of

1) For some reason aws s3 rm "s3://my-bucket/" --include "*backup-logs*" --dryrun

trying to deletes3://my-bucket/directory/

2) aws s3 rm "s3://my-bucket/" --exclude "*" --include "*backup-logs*" --dryrun

does not see files for deletion

3) I have also tried different substrings of "backup" (eg b, ba, back)

4) I also tried adding recursive (although I don't want it to be) and it finds all files in directory/

that match the pattern, but none of the top levels

I'm sure I'm doing something stupid. Thanks in advance for your help

+3


source to share


1 answer


aws s3 rm s3://my-bucket/ --recursive --exclude "*" --include "*backup-logs*"

must work.

If you want to delete multiple objects in your bucket



- recursive (logical) command is executed for all files or objects in the specified directory or prefix.

You can read http://docs.aws.amazon.com/cli/latest/reference/s3/index.html#use-of-exclude-and-include-filters about using include / exclude

+4


source







All Articles