Abhishek
Abhishek

Reputation: 107

How to retrieve S3 objects using only its name, not a path?

I am using Java SDK. When I Retrieve S3 Objects using S3ObjectSummaries.getKey() it retrieves data in a single row such as:

/MyReport/20160201-20160301/141c6a9a-a688-4b80-8a21-a8fa3ee0e49f/MyReport-1.csv.zip

So how can I retrieve data with only its name, not a path ?

Upvotes: 0

Views: 84

Answers (1)

ataylor
ataylor

Reputation: 66099

You always need the whole pathname (key) to retrieve the object.

If you just have the string MyReport-1.csv.zip, you'll need to call AmazonS3Client.listObjects() and find the object summary with a key that ends with MyReport-1.csv.zip.

Upvotes: 1

Related Questions