Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

147
Views
S3 cli includes not working

Alright I'm very confused by aws cli

I have an S3 bucket:

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

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

I'm trying to delete all the backup logs in the folder (8000 of them). I've tried every combination of includes/excludes I can think of

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

2) aws s3 rm "s3://my-bucket/" --exclude "*" --include "*backup-logs*" --dryrun doesn't see any files to delete

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

4) I've also tried adding recursive (even though I don't want it to be) and it finds all the files in directory/ that match the pattern, but none of the top level ones

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

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

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

When you want to delete multiple objects within your bucket

--recursive (boolean) Command is performed on all files or objects under the specified directory or prefix.

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

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!