Home > Language Reference > FTP Functions > FTPExistDir

FTPExistDir

The FTPExistDir function checks if the specified folder exists on the FTP server.

Usage

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

Syntax

ret=FTPExistDir(<FTP_foldername>)

Parameters

<FTP_foldername>, string, name of the folder.

Return value

Ret, optional numeric return value. If the function succeeds checking the existence of the folder 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

FTPMkDir
FTPRmDir

Example

FtpConnect("www.my_site.com","ftp","MX/WH05CZE3h") ' connection to the FTP server www.my_site.com (fake credentials!)
ret=FTPExistDir("/todelete") ' if ret returns 1, the FTP folder /todelete exists.
    If ret = 1 then
      FTPRmDir("/todelete") 'Delete the folder if it exists.
    EndIf
FtpDisconnect() ' Terminates the FTP connection