local files = {} local function ends_with(str, ending) return ending == "" or str:sub(-#ending) == ending end local p = io.popen('ls -a "/srv/filo_web/kennslur"') for file in p:lines() do if ends_with(file, '.mp4') and not ends_with(file, 'klippt.mp4') then table.insert(files, file) end end table.sort(files, function(a, b) return b < a end) local total = 6 if total > #files then total = #files end ngx.say([[