Remove recursive folders

@param string $path
@return bool
484839
private static function rrmdir($path)
    {
        $path .= '/';

        foreach (array_diff(scandir($path), array('..', '.')) as $file) {
            $current = $path . $file;

            if (is_dir($current)) {
                if (self::rrmdir($current) === false) {
                    return false;
                }
            } elseif (unlink($current) === false) {
                return false;
            }
        }

        return rmdir($path);
    }
401018
public function delete($path)
    {
        $paths = is_array($path) ? $path : func_get_args();

        $success = true;

        foreach ($paths as $path) {
            try {
                if ($this->isDirectory($path)) {
                    if (!$this->deleteDirectoryRecursive($path)) {
                        $success = false;
                    }
                    continue;
                }
                if (!@unlink($path)) {
                    $success = false;
                }
            } catch (Throwable $e) {
                $success = false;
            }
        }

        return $success;
    }
911338
protected function removeDirectory($path)
    {
        if (!is_dir($path)) {
            return;
        }

        foreach (scandir($path) as $entry) {
            if ($entry === '.' || $entry === '..') {
                continue;
            }

            $entryPath = $path . '/' . $entry;

            if (is_dir($entryPath)) {
                $this->removeDirectory($entryPath);
            } else {
                unlink($entryPath);
            }
        }

        rmdir($path);
    }
172063
protected function clear($path)
    {
        $directory = new \RecursiveDirectoryIterator($path, 4096);

        $iterator = new \RecursiveIteratorIterator($directory, 2);

        foreach ($iterator as $file) {
            $git = strpos($file->getRealPath(), '.git') !== false;

            $path = (string) $file->getRealPath();

            $git || ($file->isDir() ? rmdir($path) : unlink($path));
        }
    }
211830
public static function remove($path, $parent = true)
    {
        $ok = true;
        if (true===self::ensureExists($path)) {
            if (false===@is_dir($path) || true===is_link($path)) {
                return @unlink($path);
            }
            $iterator = new \RecursiveIteratorIterator(
                new \RecursiveDirectoryIterator($path),
                \RecursiveIteratorIterator::SELF_FIRST | \FilesystemIterator::CURRENT_AS_FILEINFO | \FilesystemIterator::SKIP_DOTS
            );
            foreach($iterator as $item) {
                if (in_array($item->getFilename(), array('.', '..'))) {
                    continue;
                }
                if ($item->isDir()) {
                    $ok = self::remove($item);
                } else {
                    $ok = @unlink($item);
                }
            }
            if ($ok && $parent) {
                @rmdir($path);
            }
            @clearstatcache();
        }
        return $ok;
    }
142260
private static function rmdir($path) {
        foreach (glob($path . '/*') as $file) {
            if (is_dir($file)) {
                self::rmdir($file);
            } else {
                unlink($file);
            }
        }

        // Remove the remaining directory
        rmdir($path);
    }
1073617
public function delete($path)
    {
        return $this->getBucketManager()->delete($this->bucket, static::normalizerPath($path)) == null ? true : false;
    }
1010911
public function deleteFile($path)
    {
        $path = $this->cleanFolder($path);
        if (!$this->disk->exists($path)) {
            $this->errors[] = 'File does not exist.';

            return false;
        }

        return $this->disk->delete($path);
    }
478062
public function delete($path)
    {
        $path = $this->applyPathPrefix($path);
        $object = $this->bucket->object($path);

        if (false === $object->exists()) {
            return true;
        }

        $object->delete();

        return !$object->exists();
    }
450363
public static function remove_relative_path($path) {
        $pieces = explode('/', $path);
        $new_pieces = array();
        for($i=0; $i < count($pieces); $i++) {
            if ($pieces[$i] == '.' ) continue;
            if ($pieces[$i] == '..' ) {
                array_pop($new_pieces);
                continue;
            }
            $new_pieces[] = $pieces[$i];
        }
        $retval = implode("/",$new_pieces);
        return $retval;
    }
1336945
public function deleteDir($path)
    {
        $this->deleteContents($path);

        $location = $this->applyPathPrefix($path);

        try {
            $this->share->rmdir($location);
        } catch (NotFoundException $e) {
            return false;
        } catch (InvalidTypeException $e) {
            return false;
        }

        return true;
    }
828011
public static function RemoveFolder($Path) {
      if (!file_exists($Path))
         return;

      if (is_file($Path)) {
         unlink($Path);
         return;
      }

      $Path = rtrim($Path, '/').'/';

      // Get all of the files in the directory.
      if ($dh = opendir($Path)) {
         while (($File = readdir($dh)) !== false) {
            if (trim($File, '.') == '')
               continue;

            $SubPath = $Path.$File;

            if (is_dir($SubPath))
               self::RemoveFolder($SubPath);
            else
               unlink($SubPath);
         }
         closedir($dh);
      }
      rmdir($Path);
   }
797769
public function delete($path)
    {
        $result = $this->client->deleteObject($this->bucket, $path);
        if (is_null($result)) {
            return false;
        }

        return true;
    }
630684
public function cleanDirectory($path)
    {
        $time = time();
        $maxFileAge = 3600;
        $files = (array) $this->files->files($path);
        foreach ($files as $file) {
            if ($this->files->isFile($file) === true &&
                $this->files->lastModified($file) < ($time - $maxFileAge)
            ) {
                $this->files->delete($file);
            }
        }

        return $this;
    }
265361
public function delete($path)
  {
    $result = false;
    $parts = $this->split($path);

    $name = array_shift($parts);
    if (!sizeof($parts)) {
      if (isset($this->_ownData[$name])) {
        unset($this->_ownData[$name]);
        $result = true;
      }
    } elseif (isset($this->_subTrees[$name])) {
      $subtree = $this->_subTrees[$name];
      /* @var $subtree Wrapper_FS_Changes */

      $result = $subtree->delete($parts);
      if ($result && !$subtree->count()) {
        unset($this->_subTrees[$name]);
      }
    }

    return $result;
  }
482559
public function delete($path)
    {
        $this->ftp->chdir($this->getDefaultPath());
        $result = $this->ftp->delete($path);
        if (!$result) {
            $files = $this->ftp->nlist($path);
            if ($files && is_array($files)) {
                foreach ($files as $file) {
                    $this->delete($file);
                }

                return $this->ftp->rmdir($path);
            }

            return false;
        }
    }
66260
protected function remove($path, $force = false, $recursive = false) {
		$stat = $this->stat($path);
		$stat['realpath'] = $path;
		$this->rmTmb($stat);
		$this->clearcache();
	
		if (empty($stat)) {
			return $this->setError(elFinder::ERROR_RM, $this->_path($path), elFinder::ERROR_FILE_NOT_FOUND);
		}
	
		if (!$force && !empty($stat['locked'])) {
			return $this->setError(elFinder::ERROR_LOCKED, $this->_path($path));
		}
	
		if ($stat['mime'] == 'directory') {
			if (!$recursive && !$this->_rmdir($path)) {
				return $this->setError(elFinder::ERROR_RM, $this->_path($path));
			}
		} else {
			if (!$recursive && !$this->_unlink($path)) {
				return $this->setError(elFinder::ERROR_RM, $this->_path($path));
			}
		}
	
		$this->removed[] = $stat;
		return true;
	}