Function __global->_deldir_contents

Definitions

sources/files2.php

  • Delete all the contents of a directory, and any subdirectories of that specified directory (recursively).
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: bool

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$dir PATH No No required parameter N/A N/A The pathname to the directory to delete
$default_preserve boolean No No False N/A N/A Whether to preserve index.html and .htaccess files (only applies to the lowest level directory)
$delete_dir_also boolean No No False N/A N/A Whether to delete the $dir at the end

Returns

  • Success status
  • Type: boolean
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Delete all the contents of a directory, and any subdirectories of that specified directory (recursively).
 *
 * @param  PATH $dir The pathname to the directory to delete
 * @param  boolean $default_preserve Whether to preserve index.html and .htaccess files (only applies to the lowest level directory)
 * @param  boolean $delete_dir_also Whether to delete the $dir at the end
 * @return boolean Success status
 */

function _deldir_contents(string $dir, bool $default_preserve = false, bool $delete_dir_also = false) : bool