Lua中遍历文件操作代码实例
写的一个关于遍历文件的程序段 记录一下咯
--[[检查所有.txt文件
比如A.txt中第一行规定有20列,但是在X行中多输入一个Tab,则输出:A表的X行填写不规范,行末有多余填写
]]
getinfo=io.popen('dir..//file/b/s')
all=getinfo:read('*all')
localfilenameList=io.open("filename.txt","wb")
filenameList:write("Path/n")
filenameList:close()
filenameList=io.open("filename.txt","a")
filenameList:write(all)
io.close(filenameList)
io.close(getinfo)
localfilenameList=tab.Open([[../filename.txt]],"Path",false)
forindex,Rowinipairs(filenameList)do
localpathlist=Row["Path"]
localrowString=string.find(pathlist,".txt")
ifrowString~=nilandrowString~=""then
moon.CheckRowlength(pathlist,pathlist)
end
end
io.popen('dir/b/s')是windows下的,通过执行命令行dir获得
io.popen('ls')是linux下的热门推荐
10 财运虎年祝福语简短语
11 单亲爸爸春节祝福语简短
12 狗狗上厕所训练
13 植物种植祝福语简短
14 翻译考试祝福语朋友简短
15 个人周年庆简短祝福语
16 狗狗怎么训练
17 分别祝福语简短搞笑英文
18 生日广州男生祝福语简短