FTPRmDir

FTP function.

The FTPRmDir function deletes a folder and its contents on 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

FTPRmDir(<FTP_foldername>)
or
ret=FTPRmDir(<FTP_foldername>)

Parameter

<FTP_foldername> : string, name of the folder to delete (and its contents) on the already connected FTP server.

Return value

Ret, numeric return code. The return code is 0 when the folder has been successfully deleted. The non zero possible error codes for FTP errros are listed in FTP functions error codes topic. During #FTPTimeout seconds, the function tries to delete the folder and its contents, and after this timeout, the standard error management is used.

Remarks

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

See also

FTPCurrentDir, FTPChDir, FTPMkDir, FTPExistDir, FTPKill

Example

 

FtpConnect("www.wintask.com","ftp","MX/WH05CZE3h") ' connection to the FTP server www.wintask.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

FtpRmDir(var$) ' deletes the folder specified in var$ (so "/upgrades/todelete")

FtpCurrentDir(var$) ' var$ contains /upgrades

FtpDisconnect() ' Terminates the FTP connection