AWS S3 - Listing all objects inside a folder without the prefix
amazon-s3, amazon-web-services, java
Solution
There is not. Linked is a list of all the methods that are available. The reason behind this is the S3 design. S3 does not have "subfolders". Instead it is simply a list of files, where the filename is the "prefix" plus the filename you desire. The GUI shows the data similar to windows stored in "folders", but there is not folder logic present in S3.
http://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/services/s3/model/S3ObjectSummary.html
Your best bet is to split by "/" and to take the last object in the array.
Problem
I'm having problems retrieving all objects (filenames) inside a folder in AWS S3. Here's my code: ``` ListObjectsRequest listObjectsRequest = new ListObjectsRequest() .withBucketName(bucket) .withPrefix(folderName + "/") .withMarker(folderName + "/") ObjectListing objectListing = amazonWebService.s3.listObjects(listObjectsRequest) for (S3ObjectSummary summary : objectListing.getObjectSummaries()) { print summary.getKey() } ``` It returns the correct object but with the prefix in it, e.g. `foldename/filename` I know I can just use Java perhaps `substring` to exclude the prefix but I just wanted to know if there is a method for it in AWS SDK.