function recurse(dir,hiddendirs,levels) if not hiddendirs then local hiddendirs = false end dir, code = fs.relativetoexact(dir) if code then print("Cannot Index: "..dir) return dir, code else print("Indexing "..dir) end if not i or not dl then i=1 dl={} else i = i + 1 end --if levels then if i >= levels then return "done" end end dl[i] = fs.dir(dir) for j=1,#(dl[i]) do -- Skip ".." ("." is skipped already in fs.dir) if dl[i][j].dir then if ( levels == nil or i > levels) and hiddendirs and dl[i][j].name ~= '..' or string.sub(dl[i][j].name,1,1) ~= "." then recurse(dir.."/"..dl[i][j].name,hiddendirs,levels) print("Back to "..fs.relativetoexact(dir)) end else print(dl[i][j].path) local currenttaginfo = taginfo.getinfo(dl[i][j].path, dl[i][j].ext) if currenttaginfo then print("["..currenttaginfo.track.."] "..currenttaginfo.artist.." - "..currenttaginfo.title) end end end i = i - 1end