I want to write a lua script that performs file moving in nextcloud 25. Can anyone provide me a script please?
i tried this script that i found somewhere
function file_move(files, dir) -- Check if the file exists if not exists(file) then return nil end
-- Get the file name and extension local file_name, file_extension = file.name(file):match("(.+)%.(.+)")
-- Set the destination folder and new name dir = dir or file.parent(file) -- new_name = new_name or file_name
-- Construct the destination path local destination_path = dir .. "/" .. new_name .. "." .. file_extension
-- Move the file local success, error_msg = file_move(file, destination_path)
if success then -- Return the updated file node return dir else -- Return nil if an error occurred return nil end end