It is convenient for us to show the pictures, especially when we are developing the APP for showing album.
Example:
dir = "/myDir"
for file in lfs.dir(dir) do
if (file ~= '.' and file ~= '..') then
print(file)
end
end
The files and directories will be all listed.The example below can show the list of all files and directories in current directory, and all files and directories of its sub-directory.
dir = "."
for file in lfs.dir(dir) do
if (file ~= '.' and file ~= '..') then
print(file)
if(lfs.attributes(file,"mode") == "directory") then
for subFile in lfs.dir(file) do
if (subFile ~= '.' and subFile ~= '..') then
print(file.."/"..subFile)
end
end
end
end
end
沒有留言:
張貼留言