Lua
Lua
Delete Remote File
See more FTP Examples
Delete a remote file.Chilkat Lua Downloads
local chilkat = require("chilkat")
-- This example requires the Chilkat API to have been previously unlocked.
-- See Global Unlock Sample for sample code.
local ftp = chilkat.Ftp2.new()
ftp.hostname = "ftp.chilkatsoft.com"
ftp.username = "myLogin"
ftp.password = "myPassword"
-- Connect and login to the FTP server.
local success = ftp:connect()
if not success then
print(ftp.last_error_text)
return
end
-- Set the current remote directory to where the file
-- is located:
success = ftp:change_remote_dir("/testing")
if not success then
print(ftp.last_error_text)
return
end
success = ftp:delete_remote_file("goodbye.txt")
if not success then
print(ftp.last_error_text)
return
end
success = ftp:disconnect()