You are here

public function S3fsFileService::deleteRecursive in S3 File System 8.3

Same name and namespace in other branches
  1. 4.0.x src/S3fsFileService.php \Drupal\s3fs\S3fsFileService::deleteRecursive()

Deletes all files and directories in the specified filepath recursively.

If the specified path is a directory then the function is called recursively to process the contents. Once the contents have been removed the directory is also removed.

If the specified path is a file then it will be processed with delete() method.

Note that this only deletes visible files with write permission.

Parameters

string $path: A string containing either an URI or a file or directory path.

callable|null $callback: Callback function to run on each file prior to deleting it and on each directory prior to traversing it. For example, can be used to modify permissions.

Throws

\Drupal\Core\File\Exception\FileException Implementation may throw FileException or its subtype on failure.

Overrides FileSystemInterface::deleteRecursive

File

src/S3fsFileService.php, line 255

Class

S3fsFileService
Provides helpers to operate on files and stream wrappers.

Namespace

Drupal\s3fs

Code

public function deleteRecursive($path, callable $callback = NULL) {
  return $this->decorated
    ->deleteRecursive($path, $callback);
}