I have an Amazon S3 account where I would like to store several directories of files.
I would like a visitor to this site to be able to see and download the files and folders I have placed there.
These files and folders will change regularly and I would prefer not to have to rewrite any html each time I added or removed files.
How can I arrange for the viewers of my site to be presented with a simple list of files/ folders?
Directories don't actually exist within S3 buckets. The entire file structure is actually just one flat single-level container of files. The illusion of directories are actually created based on naming the files names like dirA/dirB/file .
To upload folders and files to an S3 bucketSign in to the AWS Management Console and open the Amazon S3 console at https://console.aws.amazon.com/s3/ . In the Buckets list, choose the name of the bucket that you want to upload your folders or files to. Choose Upload.
You can use Javascript to list the files.
Here is the solution provided by Amazon:
http://aws.amazon.com/code/Amazon-S3/1713
You place list.html in every directory you want to list.
I have made my own listing file that provides a collapsible tree view:
https://github.com/phatmann/jS3Tree/blob/master/index.html
Neither of these files will work if you are using the S3 website feature.
I've created a simple bit of JS that creates a directory index in HTML style that would fit what you are looking for: https://github.com/rgrp/s3-bucket-listing
You can install this either directly into your s3 bucket or into a separate website (thanks to the fact that the S3 REST API supports CORS!). The README has full instructions on this: https://github.com/rgrp/s3-bucket-listing
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With