FTPKill

FTP function.

The FTPKill function deletes one or several files from the FTP server.

Syntax

FTPKill(<filename>)
or
ret=FTPKill(<filename>)

Parameter

<filename> : string, name of the file/files to delete. Multiple files are specified using wildcards (myfile.*, my???.e*, ...).

Return value

Ret, numeric return code. The return code is 0 when the file(s) have been successfully deleted. The non zero possible error codes due to an FTP error are listed in FTP functions error codes topic. During #FTPTimeout seconds, the function tries to delete the file(s), and after this timeout, the standard error management is used.

Remarks

If <filename> does not exist, FTPKill reports an error and script execution stops (if #IgnoreErrors is at its default value : #IgnoreErrors=0). So use FTPExistFile function to be sure that the file exists before deleting it.

See also

FTPRmDir

FTPExistFile

Example

 

FtpConnect("www.wintask.com","ftp","MX/WH05CZE3h") ' connection to the FTP server www.wintask.com (fake credentials!)

FtpKill("/upgrades/todelete/*.jpg") ' deletes all the files with the jpg extension from the folder /upgrades/todelete

FtpCurrentDir(var$) ' var$ contains /upgrades/todelete

FtpDisconnect() ' Terminates the FTP connection