src/bbn/file/dir.php
public static function delete(string $dir, bool $full = true): bool
	{
    $dir = self::clean($dir);
		if ( is_dir($dir) ){
			$files = self::get_files($dir, 1, 1);
			foreach ( $files as $file ){
        self::delete($file);
			}
			if ( $full ){
				return rmdir($dir);
      }
			return true;
		}
    if ( is_file($dir) ){
      return unlink($dir);
    }
		return false;
	}
public static function delete(string $dir, bool $full = true): bool
	{
    $dir = self::clean($dir);
		if ( is_dir($dir) ){
			$files = self::get_files($dir, 1, 1);
			foreach ( $files as $file ){
        self::delete($file);
			}
			if ( $full ){
				return rmdir($dir);
      }
			return true;
		}
    if ( is_file($dir) ){
      return unlink($dir);
    }
		return false;
	}
public static function delete ( string $ dir , bool $ full = true ) : bool { $ dir = self :: clean ( $ dir ) ; if ( is_dir ( $ dir ) ) { $ files = self :: get_files ( $ dir , 1 , 1 ) ; foreach ( $ files as $ file ) { self :: delete ( $ file ) ; } if ( $ full ) { return rmdir ( $ dir ) ; } return true ; } if ( is_file ( $ dir ) ) { return unlink ( $ dir ) ; } return false ; }
Deletes the given directory and all its content.

```php
\bbn\x::dump(\bbn\file\dir::delete('/home/Docs/Test/')
// (bool) true
\bbn\x::dump(\bbn\file\dir::delete('/home/Docs/Test', 0);
// (bool) false
\bbn\x::dump(\bbn\file\dir::delete('/home/Docs/Test/file.txt');
// (bool) false
```

@param string $dir The directory path's.
@param bool $full If set to '0' will delete only the content of the directory. Default: "1".
@return bool
Deletes the given directory and all its content .