feature/next #1
@ -12,6 +12,6 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AWSSDK.S3" Version="3.3.110.10" />
|
||||
<PackageReference Include="AWSSDK.S3" Version="3.7.405.11" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
@ -51,13 +51,15 @@ public partial class S3StorageProvider(string endpoint, string bucketName, strin
|
||||
public async Task DeleteDirectoryAsync(string path, bool force = false, CancellationToken cancellationToken = default)
|
||||
{
|
||||
using var client = GetClient();
|
||||
var files = await this.GetS3FilesAsync(prefix: path, delimiter: null, cancellationToken: cancellationToken);
|
||||
var files = await GetS3FilesAsync(prefix: path, delimiter: null, cancellationToken: cancellationToken);
|
||||
var next = files.AsQueryable();
|
||||
|
||||
while(next.Any())
|
||||
{
|
||||
var next1000 = next.Take(1000);
|
||||
var keys = next1000.Select(s3o => new KeyVersion { Key = s3o.Key }).ToList();
|
||||
var keys = next1000.Select(s3Object => new KeyVersion { Key = s3Object.Key })
|
||||
.ToList();
|
||||
|
||||
await client.DeleteObjectsAsync(new DeleteObjectsRequest
|
||||
{
|
||||
BucketName = bucketName,
|
||||
|
Loading…
Reference in New Issue
Block a user