This operation is done by a Task asynchronously (other Tasks will be executed concurrently without blocking execution flow)
Ftp:movefile(path, newpath)
Moves the specified file from the FTP server.
Parameters
path
A string that contains the file path (partially or fully qualified file names relative to the current FTP directory can be used).
newpath
A string that contains the new file path (partially or fully qualified file names relative to the current FTP directory can be used).
Return value
This method return a Task instance. Once the Task has finished, it will return a
boolean
value indicating if the operation was successful.
Example
local net = require "net"
-- connect to the FTP server
local url = "your ftp server"
local client = net.Ftp(url, "username", "password")
if await(client:movefile("test.txt", "/archive/test.txt")) then
print("Successfully moved FTP directory 'test.txt' to '/archive/test.txt'")
else
error(net.error)
end