lfs quirks with Mac Enumerating directory

I found teh codez0rz! On a math site no less! http://math2.org/luasearch/lfs.html

OK I trawled the interwebs and found the solution right here:

[lua]

function attrdir (path)

     for file in lfs.dir(path) do

          if file ~= “.” and file ~= “…” then

               local f = path…’/’…file

               print ("\t "…f)

               local attr = lfs.attributes (f)

               assert (type(attr) == “table”)

               if attr.mode == “directory” then

                    attrdir (f)

               else

                    for name, value in pairs(attr) do

–                         print (name, value)

                    end

               end

          end

     end

end

attrdir (".")

[/lua]

You can uncomment that line out and get all sorts of detailed info too!!

[lua]

function attrdir (path)

     for file in lfs.dir(path) do

          if file ~= “.” and file ~= “…” then

               local f = path…’/’…file

               print ("\t "…f)

               local attr = lfs.attributes (f)

               assert (type(attr) == “table”)

               if attr.mode == “directory” then

                    attrdir (f)

               else

                    for name, value in pairs(attr) do

–                         print (name, value)

                    end

               end

          end

     end

end

 

attrdir (".")

[/lua]

[lua]

function attrdir (path)

     for file in lfs.dir(path) do

          if file ~= “.” and file ~= “…” then

               local f = path…’/’…file

               print ("\t "…f)

               local attr = lfs.attributes (f)

               assert (type(attr) == “table”)

               if attr.mode == “directory” then

                    attrdir (f)

               else

                    for name, value in pairs(attr) do

–                         print (name, value)

                    end

               end

          end

     end

end

 

attrdir (".")

[/lua]