Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
ftp_rmdir() function in PHP
The ftp_rmdir() function deletes a directory on the FTP server. Remember that the directory to be deleted should be empty.
Syntax
ftp_rmdir(conn,dir);
Parameters
conn −The FTP connection
dir − The empty directory to be deleted.
Return
The ftp_rmdir() function returnsTRUE on success or FALSE on failure.
Example
The following is an example −
<?php
$ftp_server = "192.168.0.4";
$ftp_user = "jacob";
$ftp_pass = "tywg61gh";
$conn = ftp_connect($ftp_server) or die("Could not connect to $ftp_server");
$login = ftp_login($con, $ftp_user, $ftp_pass);
$mydir = "demo/";
// deleting directory
if (ftp_rmdir($conn, $mydir)){
echo "Directory deleted successfully!";
} else {
echo "Cannot delete the directory!";
}
// close
ftp_close($conn);
?>Advertisements