PHP ftp_rmdir() Function

Definition and Usage

The ftp_rmdir() function deletes a directory.

If successful, it returns true, otherwise it returns false.

Syntax

ftp_rmdir(ftp_connection,dir)
Parameter Description
ftp_connection Required. Specifies the FTP connection to be used (the identifier of the FTP connection).
dir Required. Specifies the directory to be deleted.

Description

Delete by parameter dir The specified directory.dir It must be an absolute or relative path to an empty directory.

If successful, it returns true, otherwise it returns false.

Example

<?php
$conn = ftp_connect("ftp.testftp.com") or die("Could not connect");
ftp_login($conn,"admin","ert456");
ftp_rmdir($conn,"testdir");
ftp_close($conn);
?>