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")