Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Amazon S3 query using regular expression

I have the following folder structure in S3.

myBucket/20190313/20190313_100000/_SUCCESS

I need to check whether there is _SUCCESS File present

Query I am currently using:

date = 20190313
bucket = s3Resource.Bucket(myBucket)
objs = list(bucket.objects.filter(Prefix=date+'/'))

I do not know what will be inside of the date folder. But is in yyyymmdd_hhmmss format.

Is there a way to query for that specific "_SUCCESS" file, if only "myBucket/20190313/" is known?

like image 899
ThatComputerGuy Avatar asked Apr 29 '26 03:04

ThatComputerGuy


1 Answers

The API docs says that you cant use a regex

Limits the response to keys that begin with the specified prefix. You can use prefixes to separate a bucket into different groupings of keys. (You can think of using prefix to make groups in the same way you would use a folder in a file system.)

like image 186
balderman Avatar answered May 02 '26 21:05

balderman



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!