Luaでのファイル操作コードインスタンスの遍歴
1015 ワード
ファイルを巡るプログラムのセグメントを書いて記録してください.
--[[ .txt
A.txt 20 , X Tab, :A X ,
]]
getinfo = io.popen('dir ..//file /b /s')
all = getinfo:read('*all')
local filenameList = 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)
local filenameList = tab.Open([[../filename.txt]], "Path", false)
for index, Row in ipairs(filenameList) do
local pathlist = Row["Path"]
local rowString = string.find(pathlist, ".txt")
if rowString ~= nil and rowString ~="" then
moon.CheckRowlength(pathlist, pathlist)
end
end
io.popen('dir /b /s') windows , dir
io.popen('ls') linux