Hi I am working on implementing a web based file explorer using the AWS S3 java SDK. One of the challenges that I am facing is implementing the folder navigation structure. We will probably have at most a few hundred folders that we need to retrieve from AWS but the only way I can see to get the folders is to go through every file in the bucket which will probably be 10s of thousands. This seems very wasteful. We were probably looking at having a task that runs every 30min or something to build a cache of directories but this is not an ideal solution. Any suggestions would be welcome.
EDIT: I Understand that S3 does not have a folder structure. What I am looking for is an efficient way of returning all of the prefixes without having to loop over all of the files. for example. If I have 3 files.
a/b/file.txt
a/b/file2.txt
b/file3.txt
I would like an efficient way of returning all of the unique prefixes. So I would get the following:
a/b
b