Home > Php > Removing a directory in php with rmdir()

Removing a directory in php with rmdir()

The php function rmdir() enables developers to remove a directory from the file system. The process trying to delete the directory must have enough permissions and the directory must be empty. The rmdir() function requires a string representing the path to the directory to be deleted. It returns TRUE on success or FALSE on failure.

Example code:

rmdir( "mydir" );
<?php
if (!is_dir('exampledir')) {
    mkdir('exampledir');
}
 
rmdir('exampledir');
?>

Related posts:

  1. Get a domain name's IP address with PHP
  2. 5 Tips For Using jQuery with WordPress
  3. very easy first AJAX web application
  4. Refreshing DIV content with AJAX
Categories: Php Tags:
  1. No comments yet.
  1. No trackbacks yet.