level 3
require "lfs"
local path = "C:\\Program Files"; --你要遍历的文件夹路径,注意要使用\\
function LoadFile(path)
for f in lfs.dir(path) do
if f ~= "." and f ~= ".." and f ~= ".svn" then --因为这里我的目录有装svn,所以忽略一下".svn"的情况
f = path .. "/"..f;
local attr = lfs.attributes(f);
if attr.mode == "directory" then
LoadFile(f);
elseif attr.mode == "file" then
f = string.gsub(f, "/", "\\"); --将"/"转换成"\"
local file = io.open(f, "r");
local cur = file:read("*a");
print(cur);
file:close();
end
end
end
end
LoadFile(path);
2015年12月02日 03点12分
3
安卓版可以写吗
2015年12月05日 14点12分