Home > Language Reference > FTP Functions > FTPExistFile

FTPExistFile

The FTPExistFile function checks if the specified file exists on the FTP server.

Usage

Used to check the existence of a file before using it.

Syntax

ret=FTPExistFile(<FTP_filename>)

Parameters

<FTP_filename>, string, name of the file.

Return value

Ret, optional numeric return value. If the function succeeds checking the existence of the file within 30 seconds (this default value can be changed using #FTPTimeout), the function returns 0. If the function fails, the return value is a nonzero negative value (see FTP Functions Error Codes).

See also

FTPKill

Example

FtpConnect("www.my_site.com","ftp","MX/WH05CZE3h") ' connection to the FTP server www.my_site.com (fake credentials!)
ret=FtpExistFile("/todelete/test.jpg") ' ret returns 1 if the file test.jpg exists in the FTP folder /todelete
If ret = 1 then
   FtpKill("/todelete/test.jpg") ' deletes the FTP file if it exists
EndIf

FtpDisconnect() ' Terminates the FTP connection