Hi. I have this code which returns the files and directories I need but it also returns hidden files such as
“.”
“…”
“.DS_Store”
How do I exclude these?
I want to store the actual folders and the files containing within these folders.
[lua]
local lfs = require “lfs”
local doc_path = system.pathForFile( “”, system.ResourcesDirectory )
for file in lfs.dir(doc_path) do
print("-----------------------------------------------")
if (lfs.attributes(file,“mode”) == “file”) then
print(“found file, “…file)
elseif (lfs.attributes(file,“mode”)== “directory”) then
if(file~=”.DS_Store”)then
print(“found dir, “…file,” containing:”)
for l in lfs.dir(file) do
print(l)
end
end
end
print("-----------------------------------------------")
end
[/lua]