lua 如何获取某个文件夹的所有文件的列表

RT
只获取文件名的列表就可以了

第1个回答  推荐于2016-07-10
local lfs = require"lfs"
function attrdir (path)
for file in lfs.dir(path) do
if file ~= "." and file ~= ".." then
local f = path..'/'..file
local attr = lfs.attributes (f)
assert (type(attr) == "table")
if attr.mode == "directory" then
print(f)
end
end
end
end
attrdir ("E:\\LUA")本回答被提问者采纳
相似回答