How can I provide directory listings for those viewing my Amazon S3 based static website?

Rory Becker picture Rory Becker · May 5, 2011 · Viewed 10.8k times · Source

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?

Answer

phatmann picture phatmann · Jun 12, 2011

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.