Move a file with file_move function lua script - solved

Hi Lolita,

You can read the file_move documentation here

An example script:

-- Get selected files
input_files = get_input_files()

-- To keep it simple the script only allows selecting one file
if (#input_files ~= 1) then
  abort("More than one file was selected.")
end
file = input_files[1]

-- Path to the destination folder (from the users home directory)
destination_path = "/destination_folder"

-- Move the file
success = file_move(file, destination_path)

-- Check if move succeeded
if (success) then
  add_message("File moved!")
else
  abort("Failed to move file")
end
2 Likes