views:

16

answers:

1

I have files in s3 bucket, and their names have the following format:

username#file_id#...
How to remove all john#doe#* items, without listing them? There are thousends of them, so when user request my app to delete all of them, he has to wait.

+1  A: 

There's no way to tell S3 to delete all files that meet a specific criteria - you have to delete one key at a time.

Most client libraries offer a way to filter and paginate such that you'd only list the files you need to delete and you can provide a status update. For an example, Boto's bucket listing accepts prefix as one of the parameters.

Best,

Zach

Developer, LongTail Video

zach at longtail
Yes, I know about the listing, and my code uses it to delete files one by one. But this process gets slow, if there are thousands and thousands of files to delete.
Shaman
Finally, I've got a way to solve the problem: I need to mark in my application, that this files are no more in use, and delete them in background.
Shaman