Home > Language Reference > FTP Functions > FTPRmDir

FTPRmDir

The FTPRmDir function deletes the specified folder from the FTP server.
WARNING : this function deletes the specified folder without prompting for a confirmation. It deletes too all the sub-folders if any, and all the files stored in this folder.

Syntax

ret=FTPRmDir(<FTP_foldername>)

Parameters

<FTP_foldername>, string, name of the folder to delete (and its contents).

Return value

Ret, optional numeric return value. If the function succeeds deleting 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).

Remarks

FTPRmDir reports an error if the specified folder to delete does not exist on the FTP server. You can use FTPExistDir function to check the existence of a folder before deleting it.

See also

FTPExistDir
FTPChDir
FTPMkDir

Example

FtpConnect("www.my_site.com","ftp","MX/WH05CZE3h") ' connection to the FTP server www.my_site.com (fake credentials!)
FtpMkDir("/upgrades/todelete") ' creates the subfolder todelete under the upgrades folder
FtpChDir("/upgrades/todelete") ' change the current folder to /upgrades/todelete
FtpCurrentDir(var$) ' var$ contains /upgrades/todelete
msgbox(var$)
FtpRmDir(var$) ' deletes the folder specified in var$ (so "/upgrades/todelete")
FtpDisconnect() ' Terminates the FTP connection