Stefan Radonjic
Stefan Radonjic

Reputation: 1598

Retrieve content from specified list of S3 directories

Is there a way to retrieve list of all files from specified list of directories at specific S3 bucket by invoking cloud API only once?

For example, lets say that I have following structure at my S3 cloud service:

A/
 AA/
   XXX/

B/
 BB/
   /EMPTY

C/
 /EMPTY

D/
 DD/
   XXX/

And that I also have list of directories from which I wish to retrieve content:

Requested Paths: {
    "A/AA/XXX",
    "B/BB/XXX",
    "C/CC/XXX",
    "D/DD/XXX"
}

I would like to create a map with key/value pairs where key is represented by specific directory path, and value is represented by its content. If path does not exist then key/value pair should not exist ether. Something like this:

Map {
   "A/AA/XXX" : Content
   "D/DD/XXX" : Content
}

Note that there are no keys that correspond to B/BB/XXX and C/CC/XXX since XXX is not part of B/BB//path and CC/XXX is not part of C/ path ether.

Upvotes: 0

Views: 61

Answers (1)

Adrian
Adrian

Reputation: 46442

Not with a single call, no - particularly if you have enough objects to trigger paginated results. ListObjects takes a ListObjectsInput where Prefix is a single string, not a slice/array.

Upvotes: 1

Related Questions