deletes folder (and any contained files and folders)

@throws FilesystemFolderException
500543
public function delete() {

		$this->purge();

		if(!@rmdir($this->path)) {
			throw new FilesystemFolderException(sprintf('Filesystem folder %s could not be deleted!', $this->path));
		}

		self::unsetInstance($this->path);

	}
138177
public function remove($files)
    {
        foreach ($files as $file) {
            try {
                $this->filesystem->delete($file);
            }
            catch (Exception $e) {
                // Ignore not found exceptions
            }
        }
    }
960225
private function deleteFileOrFolder(Filesystem $filesystem, string $path): bool
    {
        if ($filesystem->has($path)) {
            try {
                $metadata = $filesystem->getMetadata($path);

                if ($metadata['type'] === 'dir') {
                    $filesystem->deleteDir($path);
                }

                if ($metadata['type'] === 'file') {
                    $filesystem->delete($path);
                }
            } catch (Exception $ex) {
                return false;
            }
        }

        return true;
    }
1026848
public static void deleteDirIfExists(UnderFileSystem ufs, String path) throws IOException {
    if (ufs.isDirectory(path)
        && !ufs.deleteDirectory(path, DeleteOptions.defaults().setRecursive(true))) {
      throw new IOException("Folder " + path + " already exists but can not be deleted.");
    }
  }
968789
public static void deleteIfExists(FileSystem fs, Path path, boolean recursive) throws IOException {
    if (fs.exists(path)) {
      deletePath(fs, path, recursive);
    }
  }
1155176
public void delete() throws IOException {
        close();
        if (osFile != null) {
            boolean deleted = osFile.delete();
            while (!deleted) {
                try {
                    Thread.sleep(100);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                    logger.error("{} not deleted.", osFile);
                }
                System.gc();
                deleted = osFile.delete();
            }
        }
    }
769476
private synchronized static void delete(File file) {
        // Check if file is directory
        if (file.isDirectory()) {
            // Get all files in the folder
            File[] files = file.listFiles();

            // Delete each file in the folder
            for (int i = 0; i < files.length; ++i) {
                delete(files[i]);
            }

            // Delete the folder
            file.delete();
        } else {
            // Delete the file if it is not a folder
            file.delete();
        }
    }
1114957
public function delete() : void
    {
        $files = $this->getFiles();
        foreach($files as $file) {
            $file->delete();
        }
        rmdir($this->path);
    }
682963
public function delete(): bool
    {
        if (is_file($this->path)) {
            if (is_writable($this->path)) {
                return unlink($this->path);
            }
            throw new FileException('Cannot delete file, because ('.$this->path.') is not writable', FileException::NOT_WRITEABLE);
        }

        return true;
    }
844456
public function purge() {
        // Get all files from the cache folder
        $contents = glob($this->_storage_path . '*');

        // Remove cache files
        foreach ($contents as $content) {
            if (is_file($content)) {
                unlink($content);
            }
        }
    }
490638
public static void recursivelyDelete(File f) throws IOException {
        if (!f.exists()) {
            return;
        }
        if (f.isDirectory()) {
            for (File f1 : f.listFiles()) {
                recursivelyDelete(f1);
            }
            if (!f.delete()) {
                throw new IOException("Unable to delete directory " + f);
            }
        }
        else {
            if (!f.delete()) {
                throw new IOException("Unable to delete file " + f);
            }
        }
    }
694837
public static void cleanUpDir(final File dir) {
    try {
      if (dir != null && dir.exists()) {
        FileUtils.deleteDirectory(dir);
      }
    } catch (final IOException e) {
      logger.error("Failed to delete the directory", e);
      dir.deleteOnExit();
    }
  }
443861
protected function cleanup()
    {
        $this->filesystem->remove($this->tmpFolder);
        $this->root = null;
        $this->urlsets = array();
    }
336600
public function delete()
    {
        $return = false;
        if ($this->isExists()) {
            foreach ($this as $child) {
                $child->delete();
            }
            if (!rmdir($this->getPathname())) {
                throw new RuntimeException("Can't delete folder: " . $this->getPathname());
            }
            $return = true;
        }

        return $return;
    }
1205086
public function deleteAll()
    {
        foreach (scandir($this->directory) as $file) {
            if (!in_array($file, ['.', '..', 'keep'])) {
                unlink($this->directory . '/' . $file);
            }
        }
    }
68094
@Override
  public void delete() {
    LOGGER.debug("Deleting {}", this);
    Path path = file.file().toPath();
    if (Files.exists(path)) {
      try {
        Files.delete(file.file().toPath());
      } catch (IOException e) {
      }
    }
  }
445835
public function clean()
    {
        try {
            $this->filesystem->deleteDir($this->localPath);
        } catch (\ErrorException $e) {
            // For reasons beyond our control, the actual owner of the directory
            // contents may not be the same as the current user. Therefore we need
            // to catch ErrorException and throw an expected exception with informing
            // the current user.
            throw new FileSystemException($e->getMessage(), $e->getCode(), $e);
        }
    }