Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use S3 AmazonS3Client listObjects prefix with wildcard?

Does the AWS S3 AmazonS3Client.listObjects (http://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/index.html) support wildcard? for example, can one do the following:

ListObjectsRequest listObjectsRequest = new ListObjectsRequest().
withBucketName("foo").
withPrefix("*/dt=2013-03-28/*").
withDelimiter("/");
like image 252
mlabour Avatar asked Apr 25 '13 17:04

mlabour


1 Answers

No, you cannot. In fact, * is a valid character in a key name in S3. For example, a key like /foo/b*ar/dt=2013-03-28/abc.xml is valid.
You will either need to reorganize your keys according to a common prefix or iterate over them all.

PS: depending on your use case, it is possible that you can use a marker.

like image 150
Viccari Avatar answered Sep 23 '22 09:09

Viccari