6 assert(dir
and dir
~= "", "directory parameter is missing or empty")
7 if string.sub(dir
, -1) == "/" then
8 dir
=string.sub(dir
, 1, -2)
11 local function yieldtree(dir
)
12 for entry
in lfs
.dir(dir
) do
13 if entry
~= "." and entry
~= ".." then
15 local attr
=lfs
.attributes(entry
)
16 coroutine
.yield(entry
,attr
)
17 if attr
.mode
== "directory" then
23 return coroutine
.wrap(function() yieldtree(dir
) end)
26 print("Content-type: text/html\n\n");
27 print("<html><body>");
31 for filename
, attr
in dirtree(".") do
32 print(attr
.mode
, filename
, "<br>");
35 print("</body></html>");