delete_folder_children.lua 372 B

123456789101112131415
  1. -- KEYS[1]: full path of entry
  2. local fullpath = KEYS[1]
  3. if fullpath ~= "" and string.sub(fullpath, -1) == "/" then
  4. fullpath = string.sub(fullpath, 0, -2)
  5. end
  6. local files = redis.call("ZRANGE", fullpath .. "\0", "0", "-1")
  7. for _, name in ipairs(files) do
  8. local file_path = fullpath .. "/" .. name
  9. redis.call("DEL", file_path, file_path .. "\0")
  10. end
  11. return 0