Lua gets the file name according to the path

require "lfs"


function dirpath(path)
for file in lfs.dir(path) < span style="color: #0000ff;">do -- lfs.dir according to Path to get the file name under the path
if file ~= '.' and file ~= '..' then
local f = (path .. '/'..file)
local attr = lfs.attributes(f) -- Various attributes of the file
if attr.mode == "directory" then
print(f .. " --> " .. attr.mode)
dirpath(f)
else
print(f .. " --> " .. attr.mode)
end

end
end
end
dirpath(
"/usr")

Remove file: os.remove(filepath)

require "lfs"


function dirpath(path)
for file in lfs.dir(path) < span style="color: #0000ff;">do -- lfs.dir according to Path to get the file name under the path
if file ~= '.' and file ~= '..' then
local f = (path .. '/'..file)
local attr = lfs.attributes(f) -- Various attributes of the file
if attr.mode == "directory" then
print(f .. " --> " .. attr.mode)
dirpath(f)
else
print(f .. " --> " .. attr.mode)
end

end
end
end
dirpath(
"/usr")

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 3214 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.