Folder won't delete on Amazon S3

后端 未结 5 827
情书的邮戳
情书的邮戳 2021-02-13 14:53

I\'m trying to delete a folder created as a result of a MapReduce job. Other files in the bucket delete just fine, but this folder won\'t delete. When I try to delete it from

5条回答
  •  情书的邮戳
    2021-02-13 15:34

    Firstly, read the content of directory from getBucket method, then you got a array list of all files, then delete the file from deleteObject method.

     if (($contents = $this->S3->getBucket(AS_S3_BUCKET, "file_path")) !== false) 
     {
         foreach ($contents as $file) 
         {
         $result = $this->S3->deleteObject(AS_S3_BUCKET,$file['name']);
         }
     }
    

    $this->S3 is S3 class object, and AS_S3_BUCKET is bucket name.

提交回复
热议问题