function drush_delete_dir

8.0.x filesystem.inc drush_delete_dir($dir, $force = FALSE, $follow_symlinks = FALSE)
6.x filesystem.inc drush_delete_dir($dir, $force = FALSE, $follow_symlinks = FALSE)
7.x filesystem.inc drush_delete_dir($dir, $force = FALSE, $follow_symlinks = FALSE)
3.x drush.inc drush_delete_dir($dir)
4.x drush.inc drush_delete_dir($dir)
5.x filesystem.inc drush_delete_dir($dir, $force = FALSE, $follow_symlinks = FALSE)
master filesystem.inc drush_delete_dir($dir, $force = FALSE, $follow_symlinks = FALSE)

Deletes the provided file or folder and everything inside it.

Parameters

$dir: The directory to delete

Return value

FALSE on failure, TRUE if everything was deleted

3 calls to drush_delete_dir()
drush_pm_updatecode_rollback in commands/pm/updatecode.pm.inc
_pm_update_core in commands/pm/updatecode.pm.inc
Update drupal core, following interactive confirmation from the user.
_pm_update_move_files in commands/pm/updatecode.pm.inc
Move some files from one location to another
1 string reference to 'drush_delete_dir'
drush_move_dir in includes/drush.inc
Move $src to $dest. If the php 'rename' function doesn't work, then we'll try rsync.

File

includes/drush.inc, line 504
The drush API implementation and helpers.

Code

function drush_delete_dir($dir) {
  if (!file_exists($dir)) {
    return TRUE;
  }
  if (!is_dir($dir)) {
    return unlink($dir);
  }
  foreach (scandir($dir) as $item) {
    if ($item == '.' || $item == '..') {
      continue;
    }
    if (!drush_delete_dir($dir . DIRECTORY_SEPARATOR . $item)) {
      return FALSE;
    }
  }
  return rmdir($dir);
}