Sample code for 30+ languages & platforms
Lianja

Delete Remote File

See more FTP Examples

Delete a remote file.

Chilkat Lianja Downloads

Lianja
llSuccess = .F.

// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

loFtp = createobject("CkFtp2")

loFtp.Hostname = "ftp.chilkatsoft.com"
loFtp.Username = "myLogin"
loFtp.Password = "myPassword"

// Connect and login to the FTP server.
llSuccess = loFtp.Connect()
if (llSuccess <> .T.) then
    ? loFtp.LastErrorText
    release loFtp
    return
endif

// Set the current remote directory to where the file
// is located:
llSuccess = loFtp.ChangeRemoteDir("/testing")
if (llSuccess <> .T.) then
    ? loFtp.LastErrorText
    release loFtp
    return
endif

llSuccess = loFtp.DeleteRemoteFile("goodbye.txt")
if (llSuccess <> .T.) then
    ? loFtp.LastErrorText
    release loFtp
    return
endif

llSuccess = loFtp.Disconnect()


release loFtp