add directory iterator os.idir to lua, to avoid need to have entire directory listing in memoryUsage: for filename in os.idir('A/') do ...