LuaFileSystem
File System Library for the Lua Programming Language

## Examples

### Directory iterator

The following example iterates over a directory and recursively lists the attributes for each file inside it.

    local lfs = require"lfs"

    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 (".")

Valid XHTML 1.0!

$Id: examples.html,v 1.8 2007/12/14 15:28:04 carregal Exp $