listObjectsV2 example

public function delete(string $path): void
    {
        $this->inner->delete($path);
    }

    public function deleteDirectory(string $path): void
    {
        $prefix = $this->prefixer->prefixDirectoryPath($path);
        $prefix = ltrim($prefix, '/');
        $objects = [];
        $params = ['Bucket' => $this->bucket, 'Prefix' => $prefix];
        $result = $this->client->listObjectsV2($params);
        /** @var AwsObject $item */
        foreach ($result->getContents() as $item) {
            $key = $item->getKey();
            if ($key !== null) {
                $objects[] = new ObjectIdentifier(['Key' => $key]);
            }
        }
        if (empty($objects)) {
            return;
        }

        
Home | Imprint | This part of the site doesn't use cookies.