Delete Directory
@param string $path
480729
private static function deleteDirectory($path = '')
    {
        $directory = dir($path);
        while (($item = $directory->read()) !== false) {
            if ($item == '.' || $item == '..') {
                continue;
            }
            $file = $directory->path . '/' . $item;
            if (is_dir($file)) {
                self::deleteDirectory($file);
                continue;
            }
            unlink($file);
        }
        $directory->close();
        rmdir($path);
    }
1199167
public function removeAutomaticallyRemovedPath($path)
    {
        array_remove_value($this->automaticallyRemovedPaths, $path);
        $this->automaticallyRemovedPaths = array_values($this->automaticallyRemovedPaths);
    }
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);
    }
274431
public function remove($path) {
        // using mark.
        if ('@' == $path[0]) $path = $this->as($path);
        
        // remove file.
        if (is_file($path)) return unlink($path);

        // remove directory.
        $handle = opendir($path);
        while (false !== ($name = readdir($handle))) {
            if ('.' == $name or '..' == $name) continue;
            if (!$this->remove($path.self::DS.$name)) return false;
        }
        closedir($handle);
        return rmdir($path);
    }
1153782
protected function makeDirectory(string $path): void
    {
        if (!$this->filesystem->isDirectory(dirname($path))) {
            $this->filesystem->makeDirectory(dirname($path), 0777, true, true);
        }
    }
210494
protected function makeDir($path)
    {
        if (! file_exists(dirname($path))) {
            $this->makeDir(dirname($path));
        }

        if (! file_exists($path)) {
            mkdir($path);
        }
    }
661303
protected function emptyDirectory($directory)
    {
        foreach ($this->doListContents($directory, true) as $path) {
            $this->deletePath($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;
    }
971687
public function delete($path, $_path='/') {
		if(!headers_sent())
			setcookie($path, null, -10000, $_path);
		unset($_COOKIE[$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));
        }
    }
32368
public static function mkdir(string $path)
    {
        if (!is_dir($path))
        {
            mkdir($path, self::$dir_mode, true);
        }
    }
797769
public function delete($path)
    {
        $result = $this->client->deleteObject($this->bucket, $path);
        if (is_null($result)) {
            return false;
        }

        return true;
    }
1322698
public function delete($path)
  {
    if (is_link($path)) {
      $this->_deleteSymlink($path);
    } elseif (is_file($path)) {
      unlink($path);
    } else {
      $iteratorRd = new RecursiveDirectoryIterator($path);
      $iteratorRi = new RecursiveIteratorIterator(
        $iteratorRd, RecursiveIteratorIterator::CHILD_FIRST
      );
      foreach ($iteratorRi as $file) {
        /* @var $file \SplFileInfo */
        $filename = $file->getPathname();
        if ($file->isLink()) {
          $this->_deleteSymlink($filename);
        } elseif ($file->isDir()) {
          if (substr($filename, -1, 1) != ".") {
            rmdir($filename);
          }
        } else {
          unlink($filename);
        }
      }
      rmdir($path);
    }
  }
813242
public static function delete(string $path)
    {
        if (trim($path) === '') {
            throw new \InvalidArgumentException('$path is not a string or is whitespace');
        }

        if (!file_exists($path)) {
            return;
        }

        try {
            self::throwIfFalse(unlink($path), "unlink returned false for '{$path}'");
        } catch (\Exception $e) {
            if (file_exists($path)) {
                throw $e;
            }
        }
    }
1347583
protected function purge($path)
	{
		$directory = pathinfo($path, PATHINFO_DIRNAME);
		while ($directory != $this->uploadPath)
		{
			if (count(glob($directory .'/*')))
			{
				break;
			}

			rmdir($directory);
			$directory = dirname($directory);
		}
	}
927400
private function removePath(string $path): void
    {
        if (false !== strpos($path, '*')) {
            $paths = glob($path);
            foreach ($paths as $path) {
                $this->removePath($path);
            }
        } else {
            if (is_dir($path)) {
                $iterator = new \RecursiveDirectoryIterator($path);
                $iterator = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::CHILD_FIRST);
                /** @var \SplFileInfo $file */
                foreach ($iterator as $file) {
                    if ('.' === $file->getBasename() || '..' === $file->getBasename()) {
                        continue;
                    }
                    if ($file->isLink() || $file->isFile()) {
                        unlink($file->getPathname());
                    } else {
                        rmdir($file->getPathname());
                    }
                }
                rmdir($path);
            } else {
                if (is_file($path)) {
                    unlink($path);
                }
            }
        }
    }
1190145
protected function deleteLangFiles($path)
    {
        if (is_dir($path)) {
            $this->filesystem->cleanDirectory($path);
            $this->filesystem->deleteDirectory($path);
            return true;
        }
        return false;
    }