1. drupal
    1. 8
    2. 7
8 – 7 drupal_rmdir($uri, $context = NULL)

Remove a directory.

PHP's rmdir() is broken on Windows, as it can fail to remove a directory when it has a read-only flag set.


$uri A URI or pathname.

$context Refer to http://php.net/manual/en/ref.stream.php

Return value

Boolean TRUE on success, or FALSE on failure.

See also


Related topics

▾ 6 functions call drupal_rmdir()

color_scheme_form_submit in modules/color/color.module
Submit handler for color change form.
DrupalLocalStreamWrapper::rmdir in includes/stream_wrappers.inc
Support for rmdir().
FileTransferLocal::removeDirectoryJailed in includes/filetransfer/local.inc
Removes a directory.
file_unmanaged_delete_recursive in includes/file.inc
Recursively delete all files and directories in the specified filepath.
locale_uninstall in modules/locale/locale.install
Implements hook_uninstall().
system_update_7046 in modules/system/system.install
Switch from the Minnelli theme if it is the default or admin theme.


includes/file.inc, line 2323

function drupal_rmdir($uri, $context = NULL) {
  $scheme = file_uri_scheme($uri);
  if ((!$scheme || !file_stream_wrapper_valid_scheme($scheme)) && (substr(PHP_OS, 0, 3) == 'WIN')) {
    chmod($uri, 0700);
  if ($context) {
    return rmdir($uri, $context);
  else {
    return rmdir($uri);