Skip to content
Advertisement

Boto3: grabbing only selected objects from the S3 resource

I can grab and read all the objects in my AWS S3 bucket via

JavaScript

and then

JavaScript

would give me the path within the bucket.

Is there a way to filter beforehand for only those files respecting a certain starting path (a directory in the bucket) so that I’d avoid looping over all the objects and filtering later?

Advertisement

Answer

Use the filter[1], [2] method of collections like bucket.

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement