function drush_delete_dir

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

Deletes the provided file or folder and everything inside it.


$dir: The directory to delete

Return value

FALSE on failure, TRUE if everything was deleted

Related topics

5 calls to drush_delete_dir()
drush_pm_updatecode_rollback in commands/pm/
drush_upgrade_site_upgrade in commands/core/
Main command hook for site-upgrade.
_drush_delete_registered_files in includes/
Delete all of the registered temporary files.
_pm_update_core in commands/pm/
Update drupal core, following interactive confirmation from the user.
_pm_update_move_files in commands/pm/
Move some files from one location to another
3 string references to 'drush_delete_dir'
drush_copy_dir in includes/
Copy $src to $dest.
drush_move_dir in includes/
Move $src to $dest.
pm_update_project in commands/pm/
Update one project -- a module, theme or Drupal core.


includes/, line 1625
The drush API implementation and helpers.


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 == '..') {
    if (!drush_delete_dir($dir . '/' . $item)) {
      return FALSE;
  return rmdir($dir);