Iterate over all files in a directory

I’m trying to make a static HTML version of h5ai so I can deploy it to S3 (and remove the PHP dependency).

How easy would this be to achieve using Hugo? Can it iterate over all files in a directory?

It depends on what you want to do with the files? The closest thing I know is the readDir template function.

But as far as I know is something like content processing currently not possible.

You can combine the readDir with

But that’s probably not what the thread starter wants …

The readDir function is perfect! I don’t want to actually modify the files, just create a template/html around them to basically create an apache dir listing but nicer.

Awesome, this works really well! One question now, is it possible to change the default thing that Hugo does with directories/static files?

I basically want to put a whole lot of files in my static dir and get hugo to put index.html files in each directory that gets sync’d

Hi @Mooash, Have you solved this task? Do you have a working code sample?
I’m also interested in automatically generated index.html’s for every subfolder, to easily list files and allow users to download them.

I sadly never managed to solve this! If you manage to, please let me know!