Delete directory or file

@param string $path

@return bool
@throws \InvalidArgumentException
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;
        }
    }
395084
public function delete($path)
    {
        [$prefix, $path] = $this->getPrefixAndPath($path);

        return $this->getFilesystem($prefix)->delete($path);
    }
1203904
public function delete($path)
    {
        if ($file = $this->getFileObject($path)) {
            $name = $file->getName();
            list ($parentId, $id) = $this->splitPath($path);
            if ($parents = $file->getParents()) {
                $file = new Google_Service_Drive_DriveFile();
                $opts = [];
                $res = false;
                if (count($parents) > 1) {
                    $opts['removeParents'] = $parentId;
                } else {
                    if ($this->options['deleteAction'] === 'delete') {
                        try {
                            $this->service->files->delete($id);
                        } catch (Google_Exception $e) {
                            return false;
                        }
                        $res = true;
                    } else {
                        $file->setTrashed(true);
                    }
                }
                if (!$res) {
                    try {
                        $this->service->files->update($id, $file, $this->applyDefaultParams($opts, 'files.update'));
                    } catch (Google_Exception $e) {
                        return false;
                    }
                }
                unset($this->cacheFileObjects[$id], $this->cacheHasDirs[$id], $this->cacheFileObjectsByName[$parentId . '/' . $name]);
                return true;
            }
        }
        return false;
    }
734447
public function deleteFolder($path)
    {
        $path = self::validatePath($path);
        $fullPaths = $this->getMediaPath($path);

        return $this->getStorageDisk()->deleteDirectory($fullPaths);
    }
742968
public function deleteOnce( string $path ): bool
	{
		try {
			if( ! @ unlink( $path ) ) throw new ErrorException;
		}
		catch( ErrorException $e )
		{
			return false;
		}

		return true;
	}
937978
public function delete($path) {
		// Process Request
		$url = $this->absolutePath($path);
		$request  = $this->http->request('DELETE', $url, []);
		return $this->validateResponse($request)->getBody();
	}
732389
public static function remove($path)
    {
        $path = self::resolve($path);

        return $path && is_file($path) && unlink($path);
    }
195675
public function deleteFile($path)
  {
    $entity = $this->getEntity($path);

    if (is_null($entity)) {
      $result = null;
    } elseif (!$entity->file_exists() || !$entity->is_file()) {
      $result = null;
    } else {
      $result = Entity_Deleted::newInstance($entity);

      $changes = $this->getChanges();
      $changes->add($path, $result);
    }

    return $result;
  }
1097420
public static function removeDirectory($path) {
        if (is_dir($path))
            $dir = opendir($path);
        if (!$dir)
            return false;
        while ($file = readdir($dir))
            if (!self::isDot($file)) {
	            if (!is_dir("$path/$file"))
                    unlink("$path/$file");
	            else
                    self::removeDirectory("$path/$file");
            }
        closedir($dir);
        rmdir($path);
        return true;
    }
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();
    }
656841
public function delete ($path) {
		list ($first, $rest) = self::getFirstAndRestPathElements($path);

		# If we are going still deeper...
		if (!is_null($rest)) {
			if (array_key_exists($first, $this -> data)) {
				if ($this -> data[$first] instanceof MutableTreeInterface) {
					/** @var MutableTreeInterface $tree */
					$tree = $this -> data[$first];
					$tree -> delete($rest);
				} else {
					throw new InvalidKeyException("Value at key `" . $first . "` is a scalar; cannot step further down the requested path `" . $rest . "`");
				}
			} else {
				throw new NonExistentKeyException("Key `" . $first . "` does not exist.");
			}
		} else {
			unset($this -> data[$first]);
		}

		return $this;
	}
797769
public function delete($path)
    {
        $result = $this->client->deleteObject($this->bucket, $path);
        if (is_null($result)) {
            return false;
        }

        return true;
    }
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;
            }
        }
    }
1035392
public function purgePath($path)
    {
        if (false === file_exists($path)) {
            throw FileSystemException::invalidPath($path);
        }

        if (is_dir($path)) {
            if (false === ($dh = @ opendir($path))) {
                throw FileSystemException::lastError($path);
            }

            while (false !== ($item = readdir($dh))) {
                if (('.' === $item) || ('..' === $item)) {
                    continue;
                }

                $this->purgePath($path . DIRECTORY_SEPARATOR . $item);
            }

            closedir($dh);

            if (false === @ rmdir($path)) {
                throw FileSystemException::lastError($path);
            }
        } else {
            if (false === @ unlink($path)) {
                throw FileSystemException::lastError($path);
            }
        }
    }
1027738
private function removeDirectory(string $path): bool
    {
        $iterator = new DirectoryIterator($path);
        foreach ($iterator as $fileInfo) {
            if ($fileInfo->isDot() || !$fileInfo->isDir()) {
                continue;
            }
            $dirName = $fileInfo->getPathname();
            $this->removeDirectory($dirName);
        }

        $files = new FilesystemIterator($path);

        /** @var SplFileInfo $file */
        foreach ($files as $file) {
            $fileName = $file->getPathname();
            unlink($fileName);
        }

        return rmdir($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);
    }
391004
function removeCommandsDirectory(string $path) {
        $path = \realpath($path);
        if($path === false) {
            throw new \InvalidArgumentException('Invalid path specified');
        }
        
        $pos = \array_search($path, $this->commandsDirectories, true);
        if($pos !== false) {
            unset($this->commandsDirectories[$pos]);
        }
        
        return $this;
    }