2017-09-14 60 views
0

我有下面的代碼在S3 「文件夾」 刪除對象:AWS S3 .NET SDK:DeleteObjectsRequest回報不錯,但對象不是刪除

DeleteObjectsRequest req = new DeleteObjectsRequest(); 
req.BucketName = "mybucket/my foder 1/my folder 2"; 
req.AddKey("photo1.jpg", null); 
req.AddKey("photo2.jpg", null); 
DeleteObjectsResponse response = client.DeleteObjects(req); 

response.HttpStatusCode是確定的,而response.DeletedObjects。 Count是2.但是,實際的對象仍然存在。爲什麼?

此存儲桶的版本控制處於打開狀態,然後在創建要刪除的文件夾之前暫停。

回答

0

我解決了。應該是這樣的:

DeleteObjectsRequest req = new DeleteObjectsRequest(); 
req.BucketName = "mybucket"; 
req.AddKey("my foder 1/my folder 2/photo1.jpg", null); 
req.AddKey("my foder 1/my folder 2/photo2.jpg", null); 
req.AddKey("my foder 1/my folder 2/", null); 
DeleteObjectsResponse response = client.DeleteObjects(req);