aboutsummaryrefslogtreecommitdiff
path: root/weed/filer/redis_lua/stored_procedure/delete_folder_children.lua
blob: 77e4839f9c8235067cba9969dab14be903ebcd50 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
-- KEYS[1]: full path of entry
local fullpath = KEYS[1]

if fullpath ~= "" and string.sub(fullpath, -1) == "/" then
    fullpath = string.sub(fullpath, 0, -2)
end

local files = redis.call("ZRANGE", fullpath .. "\0", "0", "-1")

for _, name in ipairs(files) do
    local file_path = fullpath .. "/" .. name
    redis.call("DEL", file_path, file_path .. "\0")
end

return 0